Skip to content

[Workflows] Enforce CodeRabbit before Copilot on PRs #69

@ashleyshaw

Description

@ashleyshaw

Automation Summary

Enforce that CodeRabbit completes its review before Copilot (or any other AI reviewer) is requested or allowed to proceed on pull requests targeting develop and main.

Currently, CodeRabbit is configured via .coderabbit.yaml with auto_review.enabled: true and request_changes_workflow: true, but there is no workflow-level gate that prevents Copilot from being requested before CodeRabbit has posted its review. This allows a PR to receive Copilot suggestions before CodeRabbit's structural and standards checks are available, which defeats the intended review-order policy.

Problem

  • CodeRabbit and Copilot can run concurrently or in arbitrary order on PRs
  • A contributor can request Copilot review immediately after opening a PR, before CodeRabbit has finished
  • There is no status check or required review that enforces CodeRabbit must complete first
  • The intent of the review policy (CodeRabbit as first-pass structural reviewer, Copilot for targeted follow-up) is not enforceable without a gate

Proposed Solution

Add a GitHub Actions workflow (or extend the existing reviewer.yml) that:

  1. On pull_request opened/synchronised — sets a pending commit status or required check named coderabbit/review that must pass before other reviewers are requested
  2. Polls or listens for CodeRabbit's review — uses the PR review events API to detect when CodeRabbit (@coderabbitai) has posted its review and marks the status check as passed
  3. Optionally blocks Copilot auto-assignment — either via branch protection rules requiring coderabbit/review to pass, or by not auto-requesting Copilot until CodeRabbit has reviewed

Alternative: Branch Protection Rule

If a dedicated workflow is too complex, a simpler first step is to add coderabbit/review as a required status check in branch protection for develop and main, relying on CodeRabbit's own status reporting.

Steps / Checklist

  • Review how CodeRabbit reports its review status (commit status vs. check run vs. PR review)
  • Decide on approach: dedicated workflow gate vs. branch protection rule
  • Implement the chosen approach
  • Validate that Copilot requests cannot proceed until CodeRabbit's status is green
  • Document the review-order policy in CONTRIBUTING.md
  • Update .coderabbit.yaml if any config changes are needed

Acceptance Criteria

  • PRs to develop and main cannot have Copilot invoked before CodeRabbit has completed its review
  • The enforcement is visible (either as a required status check or a workflow gate)
  • Review-order policy is documented in CONTRIBUTING.md
  • No regressions to existing CodeRabbit or CI behaviour
  • PR uses branch prefix automation/ or fix/

Additional Context

Definition of Ready (DoR)

  • Problem and goal described
  • Scope defined
  • Acceptance criteria listed
  • Parent epic linked

Definition of Done (DoD)

  • All acceptance criteria met
  • Workflow/config implemented and validated on a test PR
  • Documentation updated
  • Approved by maintainer

Metadata

Metadata

Assignees

Priority

None yet

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions