Skip to content

Commit

Permalink
main: print just IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidd6 committed Feb 22, 2020
1 parent 07f18d3 commit 61e4b49
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,30 @@ def api(token, url)
url = 'https://api.github.com'

if pr
puts <<~EOS
==> PR: #{pr}
EOS
puts "==> PR: #{pr}"

pull = api(token, "#{url}/repos/#{repo}/pulls/#{pr}")
pull = JSON.parse(pull)
commit = pull['head']['sha']
end

puts <<~EOS
==> Commit: #{commit}
EOS
puts "==> Commit: #{commit}"

runs = api(token, "#{url}/repos/#{repo}/actions/workflows/#{workflow}/runs")
runs = JSON.parse(runs)
run = runs['workflow_runs'].find do |r|
r['head_sha'] == commit
end

puts <<~EOS
==> Run:
#{JSON.generate(run)}
EOS
puts "==> Run: #{run['id']}"

artifacts = api(token, run['artifacts_url'])
artifacts = JSON.parse(artifacts)
artifact = artifacts['artifacts'].find do |a|
a['name'] == name
end

puts <<~EOS
==> Artifact:
#{JSON.generate(artifact)}
EOS
puts "==> Artifact: #{artifact['id']}"

archive = api(token, artifact['archive_download_url'])
filename = "#{name}.zip"
Expand Down

0 comments on commit 61e4b49

Please sign in to comment.