C.W.K.
Stream
Lesson 04 of 04 · published

CODEOWNERS, CI, and Review Evidence

~20 min · ci, review, codeowners

Level 0Untracked Rookie
0 XP0/47 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

CI, CODEOWNERS, and review evidence

The combination of CI, CODEOWNERS, and required-review rules is what turns "we should review code" into a system. CI runs the automated checks (tests, lint, type, security) on every PR; CODEOWNERS routes the right humans to the right code; required-review rules block merge until both have signed off. None of these alone is sufficient; together they form the gate that keeps main healthy.

CI is the cheap, fast, automated half. Tests run on every push; lint catches style; type-check catches API shape errors; security scans catch known-bad dependencies and obvious leaks. The non-negotiable: CI is required for merge, no exceptions. The way teams break this is by adding "skip CI" tags or merging when CI is "probably fine" — the discipline is to fix the failing check or revert the PR, never to bypass.

CODEOWNERS handles the human routing. The file at .github/CODEOWNERS maps paths to teams or users; combined with branch protection's "Require review from Code Owners," it forces a path-aware review requirement. Auth code requires the auth team. Database migrations require the platform team. Documentation can require just the docs team. The PR review surface auto-assigns; reviewers get focused notifications; merge is blocked until the right humans approve.

Review evidence is the under-appreciated upgrade. Required conversation resolution blocks merge until every PR comment is marked resolved. Stale-approval dismissal revokes prior approvals when new commits land — preventing the "approved early, then I added a sketchy commit" pattern. Signed-off commits (git commit -s) add a Signed-off-by trailer attesting authorship under the project's contributor terms. None are required for small teams; all become essential as the team or repo's risk profile grows.

Code

Minimal effective .github/CODEOWNERS·text
# .github/CODEOWNERS
# Last matching pattern wins.

# Default reviewers for everything not otherwise claimed
*                          @core-maintainer @secondary

# Sensitive areas with team requirements
/backend/auth/             @auth-team
/frontend/src/auth/        @auth-team
/migrations/               @platform-team
/infra/                    @platform-team
*.tf                       @platform-team

# CI / build pipeline changes
/.github/                  @platform-team @core-maintainer

# Documentation can ship faster with docs team only
/docs/                     @docs-team
README.md                  @docs-team
GitHub Actions PR gate·text
# .github/workflows/pr.yml
name: PR
on:
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: '20', cache: 'npm' }
      - run: npm ci
      - run: npm run lint
      - run: npm run typecheck
      - run: npm test -- --run

  commitlint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }
      - uses: wagoid/commitlint-github-action@v6

  security:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: github/codeql-action/init@v3
      - uses: github/codeql-action/analyze@v3

External links

Exercise

On any repo where you have admin rights, do these three things: (1) add a minimal .github/CODEOWNERS with at least one path-to-team mapping, (2) configure branch protection on main to require Code Owner review and at least one status check, (3) write a simple GitHub Actions workflow that runs lint and tests on PR. Open a PR that touches the CODEOWNERS-routed path and confirm the right reviewer is auto-assigned. Note in writing one rule you would add for a regulated codebase.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.