Set a default reviewer

Github

Github Problem Overview


I do pull requests in a repo where it's always the same person reviewing. I would like to set him as the default reviewer so that I don't always have to choose him at each pull request, it'd be automatic. How to do that ?

Github Solutions


Solution 1 - Github

GitHub has the ability to set the default reviewer using a CODEOWNERS file.

> Code owners are automatically requested for review when someone opens a pull request that modifies code that they own. When someone with admin permissions has enabled required reviews, they can optionally require approval from a code owner. > > To use a CODEOWNERS file, create a new file called CODEOWNERS in the root, docs/, or .github/ directory of the repository, in the branch where you'd like to add the code owners.

Solution 2 - Github

You should add .github/CODEOWNERS file with users to send PR to.

Example to send PR for any change on codebase represented by *:

## code changes will send PR to following users
* @option1-user1 @option1-user2 @option2-your-org/team-name

See: https://docs.github.com/en/enterprise/2.18/user/github/creating-cloning-and-archiving-repositories/about-code-owners

Note: .github/CODEOWNERS should be in main branch to be effective.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRodolphe LAMPEView Question on Stackoverflow
Solution 1 - GithubosowskitView Answer on Stackoverflow
Solution 2 - GithubprayagupaView Answer on Stackoverflow