Skip to content

Commit 7f2d9d0

Browse files
committed
Fix latest run check in toolchain upload script
# Conflicts: # utils/webassembly/distribute-latest-toolchain.sh
1 parent d913218 commit 7f2d9d0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

utils/webassembly/distribute-latest-toolchain.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ github() {
1111
curl --header "authorization: Bearer $GITHUB_TOKEN" "$@"
1212
}
1313

14-
latest_run=$(github "${gh_api}/repos/${repository}/actions/workflows/${workflow_name}/runs?branch=${branch}&status=completed" | jq '.workflow_runs | sort_by(.run_number) | last')
14+
latest_run=$(github "${gh_api}/repos/${repository}/actions/workflows/${workflow_name}/runs?head_branch=${branch}&status=completed&conclusion=success" \
15+
| jq ".workflow_runs | map(select(.head_branch == \"$branch\")) | sort_by(.run_number) | last")
16+
17+
if [ -z "$latest_run" ] || [ "$latest_run" == "null" ]; then
18+
echo "No successful runs available"
19+
exit 0
20+
fi
21+
1522
artifacts_url=$(echo $latest_run | jq .artifacts_url --raw-output)
1623
head_sha=$(echo $latest_run | jq .head_sha --raw-output)
1724

0 commit comments

Comments
 (0)