How to setup multiple, specific, mandatory reviewers on github

7.7k Views Asked by At

This is what I know so far from my understanding of Github:

  1. Github allows default reviewers whether it be for a specific type of file in any/certain location through the creation of the CODEOWNERS file.

  2. Github allows the number of reviewers that are required to approve a PR. You can also specify what type of access they have.

  3. Github allows required review from Code Owners

What I want to know is if there is a way to set up mandatory reviewers meaning that the PR can't get merged until certain people give their approval.

For example, I created a PR and I have reviewers A, B, C, D, E, and F. I want to make it so that this PR cannot get merged until reviewers A and B have approved it. I thought I could use the Require review from Code Owners but I think that it only requires at least one person to approve. The other idea that came to mind was just setting the required approval to the same number of people inside the code owners. Any help would be much appreciated.

1

There are 1 best solutions below

3
On BEST ANSWER

I thought I could use the Require review from Code Owners but I think that it only requires at least one person to approve.

Your assumption is right. Currently, you can request multiple owners to review a PR, but only one of the reviews will be mandatory.

You can check the accepted answer in this GitHub Community discussion for more details.

As for the second part of your question,

setting the required approval to the same number of people inside the code owners

I believe that should do the trick. You may also want to follow the tip, described in the Approving a pull request with required reviews and ensure that code owners are the only persons with write permissions to the repo so that no other persons or groups will mess up the review process:

If your repository requires approving reviews from people with write or admin permissions, then any approvals from people with these permissions are denoted with a green check mark, and approvals from people without these permissions have a gray check mark. Approvals with a gray check mark do not affect whether the pull request can be merged.