Skip to content
Latchkey

How to Require Code Owner Reviews With CODEOWNERS

CODEOWNERS maps paths to owners, and branch protection can require an approving review from an owner of every changed path.

Create .github/CODEOWNERS mapping globs to teams or users, then enable "Require review from Code Owners" so a pull request touching those paths needs owner sign-off.

Steps

  • Create .github/CODEOWNERS mapping path globs to owners.
  • Enable "Require review from Code Owners" in branch protection.
  • Owners are requested automatically on matching pull requests.

CODEOWNERS

Terminal
# .github/CODEOWNERS
*                 @org/maintainers
/frontend/        @org/web-team
/infra/           @org/platform
*.sql             @org/dba

Require it

Settings
Settings > Branches > main
  [x] Require a pull request before merging
      [x] Require review from Code Owners

Gotchas

  • The last matching pattern in CODEOWNERS wins, so order specific rules after broad ones.
  • An invalid CODEOWNERS entry is ignored silently; check the Owners tab renders it as expected.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →