2

I am trying to build a query that would retrieve github artifacts for a given commit share for which I do know that there are runs with artifacts.

I was already able to retrieve the workflow run id using the sha using something like:

gh run list -b main -w ci \
  --json headSha,conclusion,databaseId \
  --jq ".[] | select(.headSha == \"21e6188608352ac2ed8e2d4c65e11ae2dbe20291\" and .conclusion == \"success\") \
  | .databaseId" \
  | jq  --color-output
sorin
  • 161,544
  • 178
  • 535
  • 806

1 Answers1

2
gh api repos/{owner}/{repo}/actions/artifacts \
  --jq ".artifacts[] | select(.workflow_run.head_sha == \"21e6188608352ac2ed8e2d4c65e11ae2dbe20291\")"

This should retrieve them for specific commit but you can also add and .workflow_run.id == 123 to filter by run id.

sorin
  • 161,544
  • 178
  • 535
  • 806