Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 11 of 20

Re: CODEOWNERS per branch

I understand. It's not very convenient however :-/

Also, the docs are very vague about it

 

 

Community Manager
Message 12 of 20

Re: CODEOWNERS per branch

Hi @mderazon

 

Thank you for the feedback. I have shared with the appropriate teams for consideration.

 

Please let me know if you have any other questions.

 

Cheers!

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!

Ground Controller Lvl 1
Message 13 of 20

Re: CODEOWNERS per branch

+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.

Ground Controller Lvl 1
Message 14 of 20

Re: CODEOWNERS per branch

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.

Copilot Lvl 2
Message 15 of 20

Re: CODEOWNERS per branch

Is there any other way to protect CODEOWNERS file being merged? Adding CODEOWNERS in .gitignore disables the CODEOWNERS, so this option is not working.

Community Manager
Message 16 of 20

Re: CODEOWNERS per branch

Hey @shubhra27,

 

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. 


Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Ground Controller Lvl 1
Message 17 of 20

Re: CODEOWNERS per branch

That being said, it would be super great for us if syntax could be expanded so that we can specify which branch the rule applies to in the code-owner files.
Mission Specialist Lvl 1
Message 18 of 20

Re: CODEOWNERS per branch

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.

Ground Controller Lvl 2
Message 19 of 20

Re: CODEOWNERS per branch

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

Copilot Lvl 2
Message 20 of 20

Re: CODEOWNERS per branch

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 )