mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-06 15:43:02 +02:00
utils/gh-dl-artifact.sh: Look for artifacts in all runs
Previously, the assumption was that the artifact could be found in the first run of "Bob the Builder". This does not hold in the case when: 1. An initial run is aborted, and is re-run at a later date 2. When a release is built (by "Release General")
This commit is contained in:
+15
-8
@@ -105,15 +105,22 @@ ixmsg "Locating $arch build of $rev"
|
||||
sha=$(gh api "$apibase/commits/$rev" -q .sha || die "ERROR: Unknown revision \"$rev\"")
|
||||
echo "SHA: $sha"
|
||||
|
||||
run=$(gh api "$apibase/actions/runs?head_sha=$sha" \
|
||||
-q '[.workflow_runs[] | select(.name == "Bob the Builder")][0].id' \
|
||||
|| die "ERROR: Found no workflow runs associated with $rev")
|
||||
echo "Run: $run"
|
||||
runs=$(gh api "$apibase/actions/runs?head_sha=$sha" \
|
||||
-q '.workflow_runs[] | .id' | tr '\n' ' ' \
|
||||
|| die "ERROR: Found no workflow runs associated with $rev")
|
||||
|
||||
gh api "$apibase/actions/runs/$run/artifacts" \
|
||||
-q ".artifacts[] | select(.name == \"artifact-$arch\")" >$workdir/artifact.json \
|
||||
|| die "ERROR: Found no $arch artifact associated with run $run"
|
||||
artifact="$(jq .id $workdir/artifact.json)"
|
||||
echo "Runs: $runs"
|
||||
|
||||
for run in $runs; do
|
||||
gh api "$apibase/actions/runs/$run/artifacts" \
|
||||
-q ".artifacts[] | select(.name == \"artifact-$arch\")" >$workdir/artifact.json \
|
||||
|| continue
|
||||
|
||||
artifact="$(jq .id $workdir/artifact.json)"
|
||||
[ "$artifact" ] && break
|
||||
done
|
||||
|
||||
[ "$artifact" ] || die "ERROR: Found no $arch artifact associated with any of the runs $runs"
|
||||
echo "Artifact: $artifact"
|
||||
|
||||
url="$(jq -r .archive_download_url $workdir/artifact.json)"
|
||||
|
||||
Reference in New Issue
Block a user