Skip to content

Instantly share code, notes, and snippets.

@testableapple
Last active July 29, 2020 20:26
Show Gist options
  • Select an option

  • Save testableapple/0a8471a49ab3437e697f27db4e4a190c to your computer and use it in GitHub Desktop.

Select an option

Save testableapple/0a8471a49ab3437e697f27db4e4a190c to your computer and use it in GitHub Desktop.
require 'json'
impact_map = JSON.parse(File.read('impact_map.json'))
response = JSON.parse(`curl -s -H "authorization: Bearer #{ENV['GITHUB_TOKEN']}" -X GET -G #{ENV['PULL_REQUEST']}/files`)
impacted_files = response.map { |file| file['filename'] }
impact_map.select! do |test, related_source_files|
related_source_files.any? { |file| impacted_files.include?(file) }
end
puts impact_map.keys.join(',')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment