I just set up CODEOWNERS for a github repository. Let's say we have such a line:
foobar/ @alice @bob
Also, in the repository setting, I required every pull request to get approvals from code owners. Therefore, if a pull request comes from another person, their pull request has to get approvals from either alice or bob before it is able to be merged.
So far so good. However, I found that even if alice makes a pull request, her pull request also needs to get approval from bob before it can be merged.
Is it possible to configure the repostiory so that a pull request from owner does not need owner approval? I understand that there are some scenarios in which it's better for an owner to wait for another owner's approval, so it would be great if this behavior could be configured. Thanks!
To my understanding, in your example if alice makes a matching pull request, she can still approve her own PR. Is that not what you're seeing?
Ok, I think I understand what's going on. In this instance, while alice and bob are owners of the specified code, they are not administrators on the repository? Or they are administrators and you have "Include administrators" selected on the protections for the protected brach? If alice is an administrator of the repository and "Include administrators" is unchecked then alice should be able to merge her own PR without requiring review or approval. Otherwise, yes, you are correct that currently bob would have to review and approve the PR.
I'm not sure if using a team (if this is a repo that belongs to an organization) instead of individuals would make this work differently. If this is a repo that belongs to an organization, let me know and I can dig further.
(Not sure why github.community removes formatting in my last post. Reposting)
Thanks lee-dohm! This is a private repo that belongs to our company. In our company, we chose not to designate everybody as admin. Instead, every directory has one or more designated owners, and the directory owners take responsibility for the code quality and code review for that directory.
The feature we expect is that if Alice is an owner of the directory, when she makes changes on that directory, she should still get a general code review approval from another reviewer, but she does not need to get an owner approval to merge her PR.
However, github requires owners to also get owner approval, so we have found the following funny and painful cases:
* For some directories, there is just one go-to person, so he/she is the only owner. Then we found that he/she could not merge a pull request that makes changes on the directory he/she owns.. But ironically, he/she could tell somebody else to submit a PR, and he/she approves it, then that PR could be merged :-|
* For some directories, there are two go-to persons. But often, one is in Asia, while the other is in the US. Each owner has to wait until the owner approval from the other owner (in another continent). The time cost is painful..
Thank you for the extra detail @yiming9.
This is currently a known issue that our engineering team is working on—though I can't promise an ETA of when this behaviour will change.
In the meantime, our suggestion is to either:
We'll let you know when we have any updates on this.
lee-dohm - Do users still have this problem if they use a group/team alias instead of specific people? For example, you create a group alias in github that Alice and Bob are both members of, email@example.com. Then when Alice opens up the PR, will she be able to approve her own PR as being part of the group alias, not the individual person?
I am going to end up having this same issue with our org is why I ask.
To my understanding, it doesn't matter whether they are listed individually or as members of a team. But I would recommend trying it out, just make a test repo in your organization and a test team with yourself as the only member. You can see how I tested the non-team version in a personal repo of mine.
Experiencing the same issue here. I end up disabling code owners every time i want to merge my own PR (i am the code owner)