Skip to content

Commit 1cb0852

Browse files
authored
Update wait-for-no-jobs to use job name
1 parent a488f6a commit 1cb0852

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

scripts/wait-for-no-jobs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
GITHUB_TOKEN="$GITHUB_TOKEN" # Your GitHub Personal Access Token (from env)
55
REPO="$REPO" # Your repository name (from env)
66
RUN_ID="$RUN_ID" # The specific workflow run ID (from env)
7-
JOB_ID="$JOB_ID" # The *current* job's ID (from env)
7+
JOB_ID="$JOB_ID" # The *current* job's name (from env)
88
INTERVAL_SECONDS=10 # How often to check the status
99

1010
# Function to get *overall* workflow run status
@@ -25,12 +25,14 @@ check_other_jobs_status() {
2525
non_completed_count=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
2626
-H "Accept: application/vnd.github.v3+json" \
2727
"https://api.github.com/repos/$REPO/actions/runs/$RUN_ID/jobs" | \
28-
jq --argjson jid "$JOB_ID" '
28+
jq --arg jid "$JOB_ID" '
2929
.jobs | map(
3030
# Select jobs that are NOT the current job AND are NOT completed
31-
select(.id != $jid and .status != "completed")
31+
select(.name != $jid and .status != "completed")
3232
) | length
3333
')
34+
35+
# Note: I changed --argjson to --arg for string comparison
3436

3537
if [ -z "$non_completed_count" ]; then
3638
echo "Error: Could not parse job statuses. Check JOB_ID ($JOB_ID) and API response."

0 commit comments

Comments
 (0)