Learning center

When does a repository review policy catch what CI misses?

A review policy catches what checks cannot see: who understood a change, whether the gate itself was edited, and whether reviewed history is what ships. It fails quietly in the same places. A later CODEOWNERS line can take a path away from its team, and a skipped job can satisfy a required check. Read the policy as carefully as the code it guards.

A pull request that passed every check#

Take a fictional repository, acme/shop. Its default branch is protected by a rule that requires one approval, review from code owners and a passing test-payments check. Its CODEOWNERS file reads:

*              @acme/maintainers
/payments/     @acme/payments
*.ts           @acme/frontend
/.github/      @acme/platform

A pull request changes the refund calculation in payments/refund.ts. Its author also adds one line to .github/workflows/ci.yml, because the payment tests are slow:

jobs:
  test-payments:
    if: github.event_name == 'push'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm test -- payments

Every check on the pull request is green. On a pull_request event, GitHub Actions runs the workflow "in the context of the merge commit", so the run uses the edited file. Events that trigger workflows The if: condition is false, the job is skipped, and GitHub counts success, skipped and neutral as successful states for a required check. Troubleshooting required status checks No payment test ran, and nothing in CI says so.

The policy has two chances to notice, and they go differently.

The /.github/ line works. GitHub requests review from the owners of every changed file, and with code owner review required, @acme/platform must approve the workflow edit before the pull request can merge. About code owners A platform reviewer who reads a new if: on a required job sees what CI could not. The guide on pull requests that edit their own workflow covers that boundary, and the one on skipped jobs that satisfy a required check covers the check itself.

The /payments/ line fails. In CODEOWNERS, "the last matching pattern takes the most precedence". About code owners payments/refund.ts matches /payments/ and then *.ts, so only @acme/frontend is requested. The payments team, the people who would know whether the new rounding matches the ledger, is never asked. Moving /payments/ below *.ts fixes it; why the last matching pattern wins shows how to find such shadowed lines.

So one approval from the right owner caught what a green check hid, and one line in the wrong order removed the review that would have caught the business error. Neither shows up as a failure anywhere.

Where a policy sees what checks cannot#

Checks answer questions someone wrote down in advance. A review policy decides who must look, which checks must have run, and what may change without either. Three boundaries matter most.

Ownership puts a person with context on a change. A test can confirm that refunds round to two places; it cannot tell you the finance team agreed to round half-up. Code owners, path-based required reviewers and the number of approvals decide whether that person is asked and whether their answer is required.

The gate protects itself only if you say so. Workflows, CODEOWNERS and required check names live in the repository that they gate. A pull request can edit its own workflow, rename a job so that a requirement stops matching, or change the file that names its own reviewers. Ownership of .github/, an expected source for each required check and organization-required workflows close those paths.

History and exceptions happen after review. A force push can replace reviewed commits, a moved tag can ship code that nobody approved under that version, and a bypass can merge without any of the above. Blocking force pushes, protecting release tags and keeping bypass lists narrow decide what review still means after merge.

Where policies fail quietly#

What you seeWhat actually happenedGuide
The wrong team was requestedA later CODEOWNERS line matched the same pathLast matching pattern wins
The expected owner was never requestedA line was skipped for invalid syntax, or the owner lacks write accessCODEOWNERS errors
A gitignore pattern owns nothing!, [ ] and \# do not work in CODEOWNERSSyntax differences
Owners were requested but approval was optionalCode owner review is not required by the branch ruleRequested but not required
A required check passed with no tests runThe job was skipped by if:Skipped jobs
A required check passed with failing stepscontinue-on-error turned the failure into successcontinue-on-error
A pull request waits forever for a checkThe workflow's path filter never started itWaiting for status
Checks never run in the merge queueThe workflow lacks the merge_group eventMerge queue checks
An approval survived new commitsStale approvals are not dismissedStale approvals
A workflow approved its own pull requestGitHub Actions is allowed to approve pull requestsActions approvals

Count the cost before you require it#

Every rule also blocks some merges that needed no block: a code owner asked to approve a lockfile, a rebase forced by an unrelated merge, a conversation left open by a bot. Those false positives are the price of the rule, and they teach people to bypass it. Before you enforce a rule, count what it would have blocked and how many of those blocks changed anything, as the guide on measuring a rule's false positives shows. Then carve the exceptions on purpose: an unowned path, generated files with the right owner, or a recorded emergency merge rather than a standing admin bypass.

The collection#

Code ownership:

Approvals and reviews:

Required status checks:

Rulesets, exceptions and cost:

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading