Merge pull request #7657 from SMillerDev/fix/artifact_in_pr

Only search pull requests for artifacts
This commit is contained in:
Sean Molenaar 2020-05-28 15:46:12 +02:00 committed by GitHub
commit 43ae03d6e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -407,8 +407,9 @@ module GitHub
pr_payload = open_api("#{base_url}/pulls/#{pr}", scopes: scopes)
pr_sha = pr_payload["head"]["sha"]
pr_branch = URI.encode_www_form_component(pr_payload["head"]["ref"])
parameters = "event=pull_request&branch=#{pr_branch}"
workflow = open_api("#{base_url}/actions/workflows/#{workflow_id}/runs?branch=#{pr_branch}", scopes: scopes)
workflow = open_api("#{base_url}/actions/workflows/#{workflow_id}/runs?#{parameters}", scopes: scopes)
workflow_run = workflow["workflow_runs"].select do |run|
run["head_sha"] == pr_sha
end