Skip to content

Retrieve workflow ID for a given PR #24709

Discussion options

You must be logged in to vote

I spoke to GH Support who confirmed that the only way to do this is to filter the workflow runs.

This is the approach:

  1. Use a given SHA to retrieve PR:
    /repos/{owner}/{repo}/commits/{commit_sha}/pulls

  2. Get all relevant workflows
    /repos/{owner}/{repo}/actions/runs

Query params:
branch: pr.head.ref (where pr is the PR data object from step 1)
event: "pull_request"

  1. Filter workflow runs for that particular commit using the commit SHA
    where workflow_run.head_sha === commit_sha

  2. Retrieve artefacts by using the workflow run ID from step 3
    /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@champak-7span
Comment options

@volatilemolotov
Comment options

Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment