| English | 中文 |
CODEOWNERS is used to declare which individuals or teams are responsible for reviewing specific paths.
When a PR modifies specific paths, GitHub can automatically request a Review from the corresponding owner. When combined with branch protection, it can also require approval from the respective owner before merging.
GitHub supports placing the CODEOWNERS file in these locations:
.github/CODEOWNERS
CODEOWNERS
docs/CODEOWNERS
Place it at .github/CODEOWNERS, together with repository collaboration templates.
# Default owner
* @team-platform
# Platform engineering
/.github/ @team-platform
/scripts/ @team-platform
# Business modules
/billing/ @team-billing
/auth/ @team-security
/docs/ @team-docs
The Kubernetes OWNERS file separates reviewers and approvers:
GitHub CODEOWNERS does not have these two semantic layers built-in, but enterprise teams can simulate them in their processes:
GitHub requires users or teams listed as code owners to have write access to the repository; otherwise, it will not work as expected.
If using a team as an owner, team visibility and permissions must also be configured correctly.
Overly granular rules can cause PRs to be blocked by too many people. Cover critical directories first and then gradually expand.