Thank you for the feedback. I have shared with the appropriate teams for consideration.
Please let me know if you have any other questions.
Be sure to click Accept as Solution to mark helpful posts to help other users locate important info. Also, don't forget to give Kudos for great content!
+1 on this... it would be great to have such functionality, i.e. different teams of codeowners for different branches, resulting in a separation between development and production branches... Forking could have been another way, but not possible when have to use the same account... Wish there was a `.(git)branch` folder to keep such branch specific settings. Currently, although a great feature, it is a tradeoff between QA and creating PR bottlenecks.
We are also looking for a feature so that we can define codeowners file in GitHub to have rules per specific branch, so that the same file can exist across all branches but apply its rules for the protected branch depending on what branch that is. Please let us know if GitHub has an open issue for this that we can watch or vote or has this not even been logged in.
Is there any other way to protect CODEOWNERS file being merged? Adding CODEOWNERS in .gitignore disables the CODEOWNERS, so this option is not working.
Thanks for your input here, due to the way CODEOWNERS and Branch Protection function, there currently isn't a way to do that built-in to the CODEOWNERS feature.
Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!
As a future improvement, it would be really nice if the branch owner logic could live in the CODEOWNERS file itself. Having a file exists in two different states across branches prevents normal merges and is awkward to maintain.
The same idea as these previous messages, i was curious about this:
If i put a CODEOWNERS file in `./.github` that has some rules
but then put another CODEOWNERS file in the `/` root, will it obey both?
That way we could have a sort of "global" list, and then a more ephemeral version that people can change during each PR/Branch/etc
Add the CODEOWNERS file to your .gitignore file in ALL your branches then modify each branch with respective codeowners you want (ex. prod branch with OPS codeowners/approvers & dev branch with dev codeowners/approvers) or leave it blank if that branch doesn't need codeowners. this will prevent overwrite on merge (there may be additional setting you need to enable like branch protection and you may have issues if you're an admin but i tried this and it seems to work on my repo -- i have an admin user and a regular contributer user )