Require Github PR approvals from multiple groups
Asked Answered
C

2

23

I'm using the codeowners file to require PR approvals before they can be merged. What I'd like to do is:

  1. Require all PRs to have at least one approval from a group of code owners (engineers)
  2. Require all PRs to have at least one approval from a group of QA

It seems like the code owners file does a hierarchical thing where only one group owns the code and you can create rules for certain directories but those will just override the default code owner.

My current .github/CODEOWNERS file looks like this:

* @my-org/engineer-code-owners

Is there a way to require at least one approval from two different groups?

Canonist answered 26/3, 2021 at 17:21 Comment(0)
D
14

You can list multiple users/groups on a single line (separated by a single space) to request multiple reviews.

* @my-org/engineer-code-owners @my-org/qa-code-owners

As of time of writing, there’s no way to require a review from all code owners assigned to a pull request.

Is there any way to require all of the listed people to approve?

No, there currently isn’t a way to do that built-in to the CODEOWNERS feature.

See CODEOWNERS reference and thread on required reviews.

Decorticate answered 26/3, 2021 at 18:17 Comment(3)
And would this allow me to require at least one review from each group?Canonist
@brady-dowling unfortunately no. Updated my answer to reflect this.Decorticate
grrrrr - I wanted that too!!!Fructose
B
7

On one line of CODEOWNERS, you can request reviews from multiple reviewers but you can't require approvals.

In the repo settings, branch protection, you can require a certain number of approvals but you can't specify who.

I was really hoping I could stop myself merging without QA approval!

Ber answered 23/2, 2023 at 14:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.