-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Closed
Labels
enhancementa request to improve CLIa request to improve CLIgh-runrelating to the gh run commandrelating to the gh run commandhelp wantedContributions welcomeContributions welcome
Description
Describe the feature or problem you’d like to solve
My goal is to download an artifact from the latest successful workflow run for a specific commit. While releases are the general/best way to get artifacts, for development and integration testing between repos it's often helpful to incorporate artifacts from specific branches and/or commits.
After #3321 and #3349, it's gotten magnitudes simpler:
# get the latest successful CI run number for main
$ gh run list -b main -s success -w Build -L 1 --json databaseId -q .[0].databaseId
123456789
# get the artifact and extract it
$ gh run download 123456789 -n my-artifactBut it would be great to be able to point to a specific commit.
You can do it hackily via:
$ gh run list -s success -w Build -L 1000 --json headSha,databaseId -q ".[] | select(.headSha == \"${SHA}\") | .databaseId"But it's slow with larger limits, and the limit is kinda arbitrary — if you do too many runs it will drop off the bottom.
The List Workflow runs API supports head_sha as a parameter...
Proposed solution
Add -c SHA as an option to gh run list:
Then our get-the-artifact workflow becomes:
$ gh run list -s success -c c0ffeec0ffeec0ffee -w Build -L 1 --json databaseId -q .[0].databaseId
123456789
$ gh run download 123456789 -n my-artifactodinho
Metadata
Metadata
Assignees
Labels
enhancementa request to improve CLIa request to improve CLIgh-runrelating to the gh run commandrelating to the gh run commandhelp wantedContributions welcomeContributions welcome