Skip to content

ci: guard ready-for-review label against draft PRs and handle undraft#570

Merged
xdustinface merged 1 commit intov0.42-devfrom
ci/guard-draft-pr-label
Mar 21, 2026
Merged

ci: guard ready-for-review label against draft PRs and handle undraft#570
xdustinface merged 1 commit intov0.42-devfrom
ci/guard-draft-pr-label

Conversation

@xdustinface
Copy link
Collaborator

@xdustinface xdustinface commented Mar 21, 2026

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.

Summary by CodeRabbit

  • Chores
    • Refined CI check evaluation logic to improve status consistency
    • Enhanced ready-for-review workflow with improved draft pull request handling and unified event processing across multiple trigger types

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.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
CI Check Filtering
.github/scripts/check_ci_status.sh
Updated jq expression to exclude validate-triggers and evaluate checks instead of on-review and on-ci-complete, altering which checks are considered for determining CI status outcomes.
Workflow Event Handling Refactoring
.github/workflows/ready-for-review.yml
Consolidated event-specific logic into a single evaluate job with unified branching on github.event_name. Added support for pull_request triggers, draft PR filtering, and conditional label management based on CodeRabbit review state and CI status across multiple event types.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Whiskers twitching with glee,
Event flows now unified, you see,
Draft PRs skip away,
Labels dance night and day,
CI checks flow smoothly—hooray! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding draft PR guards and handling undraft scenarios for the ready-for-review label, which aligns with consolidating CI jobs and introducing new event handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/guard-draft-pr-label

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/ready-for-review.yml (1)

36-40: Consider using yq for 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 yq would 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 yq to 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2ac3c9c and 73dba00.

📒 Files selected for processing (2)
  • .github/scripts/check_ci_status.sh
  • .github/workflows/ready-for-review.yml

@github-actions github-actions bot added the ready-for-review CodeRabbit has approved this PR label Mar 21, 2026
@xdustinface xdustinface merged commit fe82b98 into v0.42-dev Mar 21, 2026
34 of 36 checks passed
@xdustinface xdustinface deleted the ci/guard-draft-pr-label branch March 21, 2026 15:13
@codecov
Copy link

codecov bot commented Mar 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.35%. Comparing base (2ac3c9c) to head (73dba00).
⚠️ Report is 1 commits behind head on v0.42-dev.

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     
Flag Coverage Δ
core 75.13% <ø> (ø)
ffi 36.80% <ø> (ø)
rpc 28.28% <ø> (ø)
spv 81.20% <ø> (+0.08%) ⬆️
wallet 66.27% <ø> (ø)
see 2 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review CodeRabbit has approved this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant