ci: stop evaluate failing when a PR's CI is pending or red - #844
Conversation
`check_ci_status.sh` runs `gh pr checks` under `set -euo pipefail`. That command exits `8` when any check is still pending and non-zero when any check fails, even with `--json`, so the script aborted before echoing its status whenever the PR's own CI was not fully green. The caller assigns its output with `CI_STATUS=$(check_ci_status.sh ...)`, also under `set -e`, so the failed command substitution took the whole `evaluate` job down with "exit code 1". This surfaced constantly after the `workflow_run` relay landed, because `evaluate` now re-runs on every review and label event, routinely while CI is still pending or red, which is exactly when `gh pr checks` returns non-zero. Capture the JSON with `|| true` and treat empty output as `no_checks`, so the `jq` rollup classifies `pending`/`has_failures`/`all_passed` instead of aborting the caller.
|
Warning Review limit reached
Next review available in: 36 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe CI status script's ChangesCI Status Script Fix
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/scripts/check_ci_status.sh:
- Around line 11-20: The CHECKS capture in check_ci_status.sh is swallowing all
gh pr checks failures, so unexpected auth/rate-limit/network errors are
misclassified as no_checks. Update the logic around the gh pr checks call to
distinguish the expected non-zero exit cases from real failures, keep stderr
visible for unexpected errors, and only treat truly empty JSON output as
no_checks before the jq rollup runs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a9cce095-4220-4972-af76-7e45bcb61275
📒 Files selected for processing (1)
.github/scripts/check_ci_status.sh
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #844 +/- ##
==========================================
+ Coverage 73.33% 73.36% +0.02%
==========================================
Files 324 324
Lines 72923 72923
==========================================
+ Hits 53478 53498 +20
+ Misses 19445 19425 -20
|
The previous `2>/dev/null || true` collapsed every `gh pr checks` failure into empty output, which `check_ci_status.sh` then reported as `no_checks`, stripping the `ready-for-review` label and turning the job green on a broken state with the error hidden. `gh pr checks --json` exits 0 when checks passed or failed (the failure exit code is suppressed by `--json`) and 8 when they are pending. Any other exit code means gh itself failed (auth, rate limit, network, unknown PR). Tolerate only the expected 0 and 8, propagate anything else with stderr intact, and treat empty output as `no_checks` only when gh actually succeeded. Addresses CodeRabbit review comment on PR dashpay#844 dashpay#844 (comment)
Problem
The
evaluatejob in the "Ready for Review Label" workflow goes red on pull requests whenever the PR's own CI is not fully green. This is highly visible on fork PRs (for example #837), where it shows a failing check right on the automation #838 was meant to make work.Root cause
.github/scripts/check_ci_status.shruns underset -euo pipefail, and its one real command is:gh pr checksreports the check rollup through its exit code, even with--json: it exits8when any check is still pending and non-zero when any check has failed. Underset -ethe script therefore aborts before echoing its status whenever the PR's CI is pending or red. The caller assigns that output withCI_STATUS=$(check_ci_status.sh ...), also underset -e, so the failed command substitution takes the wholeevaluatejob down with "exit code 1".The
gh pr checksgotcha predates #838, but that PR'sworkflow_runrelay made it surface constantly:evaluatenow re-runs on every review and label event, routinely while CI is still pending or red, which is exactly whengh pr checksreturns non-zero.Fix
Capture the JSON with
|| trueso the non-zero exit no longer aborts the caller, and treat empty output asno_checks. The existingjqrollup then classifiespending/has_failures/all_passedas intended, soevaluateexits0and simply removes the label while CI is unfinished, then adds it once everything is green.No behavior change when CI is fully green. Verified the rollup still returns
all_passed,pending,has_failures, andno_checksfor the corresponding check states, including correctly excluding the gate jobs (validate-triggers,evaluate,ready-for-review-trigger) from the tally.Summary by CodeRabbit