Skip to content
Latchkey

How to Encode Service Ownership With CODEOWNERS

A CODEOWNERS file maps repo paths to owning teams so GitHub auto-requests the right reviewers.

Put a CODEOWNERS file in .github/, map paths to teams, and enable required review from code owners. Keep the owner team the same one named in catalog-info.yaml so ownership is consistent everywhere.

Steps

  • Add .github/CODEOWNERS.
  • Map globs to @org/team handles (later rules win).
  • Enable Require review from Code Owners in branch protection.
  • Match the owning team to the catalog spec.owner.

CODEOWNERS

CODEOWNERS
# Default owner for everything
*                 @my-org/team-payments

# Infra changes need the platform team too
/.github/         @my-org/team-platform
/terraform/       @my-org/team-platform

Gotchas

  • The last matching pattern wins, so put broad defaults first and specific paths last.
  • A team can only be auto-requested if it has at least read access to the repository.

Related guides

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