Enforce codeowners.yml approval on GitHub pull requests — request reviewers when a PR opens, publish a Code Owners commit status, and track check results in the console.
Built with SuperPlane.
- On pull request — listen for
opened,synchronize, andreopenedevents on a selected repository - On PR review — re-check when a review is submitted
- Check code owners — read
codeowners.ymlfrommainormaster, map changed files to owners and groups, and verify each covered file is approved - Request reviewers — when a pull request is opened, add reviewers from
codeowners.ymlfor the changed files (author and existing approvers are skipped) - Enforce — publish a Code Owners commit status (success or failure) on the PR head commit
- Console — recent checks table backed by the
codeownersChecksmemory namespace
- SuperPlane account
- GitHub integration connected to the target repository
codeowners.ymlat the repository root onmainormaster
- Add
codeowners.ymlto your repository root onmainormaster. - Connect GitHub — bind the integration on On Pull Request, On PR Review, Add pull request reviewers, and the status nodes. Select your repository on both triggers.
- Branch protection — require the Code Owners status check before merging.
- Optional: add a
GITHUB_TOKENsecret on Check code owners for private repositories.
groups:
frontend-team:
- alice
- bob
docs-team:
- carol
rules:
- pattern: "/src/**"
self_approval: true
owners:
- "@frontend-team"
- "@eve"
- pattern: "/docs/**"
self_approval: false
owners:
- "@docs-team"- Patterns are matched from the repository root — use a leading
/(for example,/pkg/models/**) - The last matching rule wins
self_approvaldefaults tofalse- Groups are defined under
groupswith GitHub usernames; reference them inownersas@group-name - Checks run only on pull requests into
mainormaster
Add a secret named GITHUB_TOKEN on the Check code owners node. It is used to read repository contents and pull request files from the GitHub API.
- Private repositories: required
- Public repositories: optional, but recommended to avoid unauthenticated API rate limits
- Repository access: Only select repositories → choose the target repository
- Repository permissions:
- Contents: Read
- Metadata: Read
- Pull requests: Read
| Setting | Default |
|---|---|
| Policy file | codeowners.yml |
| Policy branch | main or master |
| Target branches | main, master |
| Status context | Code Owners |
| Memory namespace | codeownersChecks |
| Reviewer assignment | On opened only |
MIT