ci: guard ready-for-review label against draft PRs and handle undraft#570
ci: guard ready-for-review label against draft PRs and handle undraft#570xdustinface merged 1 commit intov0.42-devfrom
ready-for-review label against draft PRs and handle undraft#570Conversation
Consolidate three separate jobs (`on-review`, `on-ci-complete`, `on-undraft`) into a single `evaluate` job that handles all event types. Add draft PR checks so the label is never applied to draft PRs, and add a `ready_for_review` trigger so the label is evaluated when a PR is undrafted.
📝 WalkthroughWalkthroughThe changes update GitHub CI check filtering patterns and restructure the workflow to consolidate review-status label evaluation into a unified job. The new design handles multiple event types through branching logic and introduces draft PR filtering. Changes
Sequence Diagram(s)sequenceDiagram
actor GitHub as GitHub Events
participant Job as evaluate Job
participant PR as PR/CodeRabbit
participant CI as CI System
GitHub->>Job: Trigger (pull_request_review / workflow_run / pull_request)
Job->>Job: Determine PR number from event context
Job->>PR: Query isDraft property
alt Is Draft PR
Job->>Job: Skip processing (continue)
else Not Draft
par Parallel Checks
Job->>PR: Check CodeRabbit review state
Job->>CI: Check CI status (all_passed)
and
end
alt Review APPROVED AND CI all_passed
Job->>PR: Add ready-for-review label
else
Job->>PR: Remove ready-for-review label (best-effort)
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 Tip You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.Change the |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/ready-for-review.yml (1)
36-40: Consider usingyqfor more robust YAML parsing.The current grep/sed approach assumes the workflow names remain in single-line array format. If someone reformats to multi-line YAML, this parsing will break. While the validation job failing would alert the developer, using
yqwould be more resilient.♻️ Alternative using yq
- MONITORED=$(grep -A1 'workflows:' "$SELF" \ - | grep '\[' \ - | tr ',' '\n' \ - | sed 's/.*"\([^"]*\)".*/\1/') + MONITORED=$(yq '.on.workflow_run.workflows[]' "$SELF")Note: This would require
yqto be available in the runner environment, or adding an installation step.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ready-for-review.yml around lines 36 - 40, Replace the fragile grep/sed pipeline that populates MONITORED from "$SELF" with a yq-based extraction to robustly read the workflow_run workflows array (e.g., use a command like MONITORED=$(yq e '.on.workflow_run.workflows[]' "$SELF") or equivalent to emit one name per line); ensure the workflow uses an installation step or runner image that provides yq before this command runs and keep references to the same variables (MONITORED and SELF) so downstream logic is unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/ready-for-review.yml:
- Around line 36-40: Replace the fragile grep/sed pipeline that populates
MONITORED from "$SELF" with a yq-based extraction to robustly read the
workflow_run workflows array (e.g., use a command like MONITORED=$(yq e
'.on.workflow_run.workflows[]' "$SELF") or equivalent to emit one name per
line); ensure the workflow uses an installation step or runner image that
provides yq before this command runs and keep references to the same variables
(MONITORED and SELF) so downstream logic is unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3737330f-1bab-49d3-aa4a-86c98d897f1e
📒 Files selected for processing (2)
.github/scripts/check_ci_status.sh.github/workflows/ready-for-review.yml
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v0.42-dev #570 +/- ##
=============================================
+ Coverage 66.33% 66.35% +0.01%
=============================================
Files 311 311
Lines 64976 64976
=============================================
+ Hits 43102 43113 +11
+ Misses 21874 21863 -11
|
Consolidate three separate jobs (
on-review,on-ci-complete,on-undraft) into a singleevaluatejob that handles all event types. Add draft PR checks so the label is never applied to draft PRs, and add aready_for_reviewtrigger so the label is evaluated when a PR is undrafted.Summary by CodeRabbit