I've got a repository with 3 total collaborators, and the master/dev branches are set up to be:
Now, as I understood things, my open PR towards the dev branch should request a review from all Code Owners, but a single approved review should be enough to review.
My PR automatically requested review from the other two collaborators, since both are Code Owners. So far, so good. One of them requested changes, which we discussed, made, and then approved. So the current status of his review is "approved"--yet this is not enough to merge the PR?
The status box says
Solved! Solved! Go to Solution.
It's hard to say why you're experiencing this behavior without some more information. Is the repository in question public? Can you share a link to a specific PR that is behaving in a way that you believe is not expected?
Assuming that the repository in question is private, I can guess at one reason why more than one reviewer might be required. Let's say you have a CODEOWNERS like the following:
* @foo @bar @baz
In this case, any PR would require one (and only one) of those three people to approve it before it could be merged. But let's say you have a more complex CODEOWNERS file:
*.js @foo @bar docs/ @baz
Maybe you could share just your CODEOWNERS file?
I figured it out; it was similar to what you describe below, where my changes were targeting two different patterns, requiring a review from two separate people to approve each change.
Thanks for your help!
I don't see any code example. I found a blurb about branches, but nothing telling us how
Each CODEOWNERS file assigns the code owners for a single branch in the repository. Thus, you can assign different code owners for different branches, such as @octo-org/codeowners-team for a code base on the master branch and @octocat for a GitHub Pages site on the gh-pages branch.
on the docs page; what does an actual branch reference look like? would we have a new CODEOWNERS file per branch, or would we have the same CODEOWNERS file with all the branches and reviewers listed?
It's probably better explained by saying that the one CODEOWNERS file has different contents per branch. So if there is one rule in the file on the `master` branch but a different rule in the file on the `foo` branch, then the first rule applies when things are being merged into `master` and the second rule applies when things are being merged into `foo`. In both cases, the format of the CODEOWNERS file is the same and there is no mention of a branch reference within the contents of the CODEOWNERS file itself.
* @foo @bar @baz
"In this case, any PR would require one (and only one) of those three people to approve it before it could be merged"
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. If that was the one and only rule, you could do a hacky solution where you required a PR to have three approvals to be merged but if the CODEOWNERS contents ever changed, you would have to remember to manually update the number of required reviews. So it isn't something I would recommend as a solution to the question you're asking.