Skip to content

Commit b749ce8

Browse files
nsheapsclaude
andcommitted
fix: check statusCheckRollup.state for pending CI
When CI is still starting up (e.g., workflow jobs queued but not yet created), the rollup state is PENDING but no individual check nodes with PENDING status exist yet. The script was falling through to CI_FAIL because $any_running evaluated false. Capture the rollup-level .state field and incorporate it into the $any_running calculation so PENDING/EXPECTED rollup states correctly show as 🟡 (running) instead of 🔴 (failed). Co-Authored-By: Claude Code (/Users/nathan.heaps/src/stainless-api/stainless) <noreply@anthropic.com>
1 parent a536d7f commit b749ce8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

bin/gs-stack-status

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,10 @@ if [[ -n "$repo_owner" && ${#pr_number_to_branch[@]} -gt 0 ]]; then
402402
(.commits.nodes[0].commit.statusCheckRollup // null) |
403403
if . == null then "NO_CI"
404404
else
405+
# Capture rollup-level state for cases where checks haven't been
406+
# created yet (e.g., queued workflow jobs). The rollup knows CI is
407+
# pending even when no individual PENDING check nodes exist.
408+
(.state // "UNKNOWN") as $rollup_state |
405409
(.contexts.nodes // []) as $nodes |
406410
($nodes | map(select(. != null))) as $all_valid |
407411
# Deduplicate: GitHub returns stale check runs from older workflow
@@ -448,7 +452,7 @@ if [[ -n "$repo_owner" && ${#pr_number_to_branch[@]} -gt 0 ]]; then
448452
.cState != null and (.cState | IN("FAILURE", "ERROR"))
449453
)) | length) as $sc_failed |
450454
451-
(($cr_running + $sc_running) > 0) as $any_running |
455+
(($cr_running + $sc_running) > 0 or ($rollup_state | IN("PENDING", "EXPECTED"))) as $any_running |
452456
(($cr_failed + $sc_failed) > 0) as $any_failed |
453457
454458
if $any_running and $any_failed then

0 commit comments

Comments
 (0)