Default reviewers for pull requests
1 min readJul 1, 2021
Github lets you assign default reviewers to repositories.
First let’s make a Github team. This should contain everyone you want to get notified when a Pull Request is created.
I’ve named mine dev-owners and added the users to the group.
Github Settings
Next give your group adequate permissions to the repository.
- Click Settings -> Manage access
- Invite teams
- Add dev-owners group and set permissions to write or admin
Then create a rule
- Click Settings -> Branches
- Add Rule
- Branch pattern: *
- Tick: Require pull request reviews before merging
- Tick: Require review from Code Owners
Repository
Finally create a file in the root of the repository named: CODEOWNERS
Add the rule followed by the team name. Note the rules are the same as .gitignore.
The following example adds dev-owners as reviewers to any file change.
* @ORG_NAME/dev-owners
Now every pull request created will automatically notify the users in dev-owners group and require at least 1 approval before merge.