Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit Github codeowners file to specific branches only?

Tags:

github

I'm using CODEOWNERS file on Github to setup automatic pull-request reviewers based on files/folders. The system works well and reviewers get added automatically to pull-requests.

However, I want to limit this setup just for release branches, and not for private branches. When a private branch is taken off of a release branch, it also gets the CODEOWNERS file and in turn all the "automatic reviewers for pull-requests" setup.

Is there a way to make sure that the CODEOWNERS file applies only to specific branches? Or a way to make sure that this particular file doesn't get synced to other branches at all?

like image 866
ronakg Avatar asked Sep 19 '18 20:09

ronakg


Video Answer


1 Answers

You can enforce pull request reviews from CODEOWNERS based on branches.

In your Repo, Go to: Settings -> Branches -> Add Rule -> Apply rule to <your branch> .
Then mark Require pull request reviews before merging -> Require review from Code Owners

This will make sure the rule only applies to that specific branch

like image 99
orepor Avatar answered Nov 09 '22 01:11

orepor