CODEOWNERS generator — assign reviewers by path on GitHub

Write each path pattern followed by its owners, and the tool produces a GitHub CODEOWNERS file with a default owner rule first, @ signs added where they are missing, and warnings for patterns GitHub does not support.

Live demo · real result from this tool

CODEOWNERS

# CODEOWNERS — save as .github/CODEOWNERS (or CODEOWNERS / docs/CODEOWNERS).# The LAST matching pattern takes precedence, so general rules go first. # Default owners* @acme/maintainers /docs/ @acme/docs-team*.js @asha/src/payments/ @asha @ravi/.github/ @acme/platform 

Processed on your device — nothing is uploaded.

How to use the CODEOWNERS generator

  1. In Default owners for everything (*), enter the people or teams who review any file not covered by a later rule, for example acme/maintainers. Leave it blank to skip the * rule.
  2. In Rules, write one line per pattern: the pattern, a space, then one or more owners separated by spaces.
  3. Add # comment lines if you want headings; they are copied as they are.
  4. Copy or download the file, save it as CODEOWNERS in .github/, and commit it to your default branch.

What it does and when to use it

A CODEOWNERS file tells GitHub who is responsible for which parts of a repository. When a pull request touches a matching file, the owners are added as reviewers automatically. It suits teams where payments code needs the payments team and docs changes need a writer, and solo maintainers who want one reviewer always requested.

The file is one piece of a tidy repository. The pull request template generator shapes what reviewers see, the CONTRIBUTING.md generator explains the review process to newcomers, and the GitHub Actions generator adds the automated checks that run beside the human review.

How it works

Each owner is checked in turn. A name with no @ gets one (asha becomes @asha, acme/docs-team becomes @acme/docs-team). Names that already start with @ and email addresses are left untouched. Default owners may be separated by spaces or commas.

The tool warns about two problems but still writes the line, so you can see it and fix it:

  • a pattern starting with ! or containing [ ], which GitHub’s code owners syntax does not support;
  • a pattern with no owner, which removes ownership for that path and is usually a slip.

Worked examples

The sample rules give this file body:

# Default owners
* @acme/maintainers

/docs/ @acme/docs-team
*.js @asha
/src/payments/ @asha @ravi
/.github/ @acme/platform

Mistakes flagged. With no default owner and the rules !secret.txt bob, docs/ dev@example.com and /vendor/, the email stays as typed, while the warnings say “CODEOWNERS does not support ! negation or [ ] character ranges.” and that /vendor/ has no owner.

Mixed input. Default owners @octo-org/web lead-dev become * @octo-org/web @lead-dev.

Limits and tips

  • The tool cannot check that users or teams exist or have write access.
  • Rules are kept in the order you type them; it does not sort or merge them.
  • Patterns follow .gitignore style, with exceptions: /docs/ matches the top-level folder only, while docs/ matches a docs folder anywhere.

Frequently asked questions

Where do I save the CODEOWNERS file?
In .github/CODEOWNERS, in the repository root, or in docs/CODEOWNERS. It must be on the branch that pull requests target, usually main, before GitHub uses it.
Which rule wins when two patterns match a file?
The last matching line in the file. That is why the default * rule comes first and the most specific paths should come last.
How do I make code owners required reviewers?
Turn on branch protection (or a ruleset) for the target branch and enable "Require review from Code Owners". Without that setting, owners are only requested for review, not required.
Can I use an email address instead of a username?
Yes. An address such as dev@example.com is kept without an @ prefix. It must belong to a GitHub account that has write access to the repository.
Why does my team not get review requests?
Teams must be written as @org/team-name, be visible, and have write access to the repository. Check the CODEOWNERS file view on GitHub, which marks lines it cannot resolve.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close