Skip to content

Using CODEOWNERS for Enforced Reviews

A CODEOWNERS file assigns responsibility for parts of a repository so GitHub can request reviews from the right people.

  1. Add a CODEOWNERS file in the repository root, .github/, or docs/ directory.
  2. List file patterns followed by GitHub usernames or teams, for example:
    docs/* @docs-team
    src/api/ @backend
  3. Commit and push the file to the default branch.
  • Navigate to Settings > Branches > Branch protection rules.
  • Create or edit a rule and enable Require review from Code Owners.
  • Merging into protected branches now requires approval from listed owners.
  • Prefer teams over individual users for easier maintenance.
  • Keep patterns specific to avoid unexpected review requests.
  • Review ownership regularly as code moves or teams change.