Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to write a CODEOWNERS file that adds reviewers but only requires approval for one branch?

Mandy Meindersma
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 28, 2025

So I have a CODEOWNERS file that looks like this:

 

-------

* @@"Backend" @@"Frontend"

**/*.js @@"Frontend" 

**/*.java @@@"Backend

Check(@@"Globe Backend" >= 1)

Check(@@"Globe Frontend" >= 1)
--------

But I would only like to do those checks on the master branch. I would like the groups to be added on all prs but only require approval for merging into certain branches. 

 

using `CODEOWNERS.destination_branch_pattern master` means the whole file is only used on the master branch where I would only like to use it for the check lines. 

1 answer

0 votes
antoine_doeraene
Contributor
January 29, 2025

Hello Mandy!

I am Antoine from Mibex Software. From the look of your file (in particular your two `Check` clauses), it seems that you are using our DevSensei/Code Owners plugin for Data Center. So I take the chance to answer you.

You are right that adding the destination branch pattern disables the whole file, and not only the checks. Unfortunately, using `CODEOWNERS` file alone, there is no way to get that level of granularity.

That said, with recent versions of the plugin (at least 8.0), you have the possibility to rather use `devsensei.yaml` files (see the app's documentation). These configurations will give you the necessary flexibility to apply your checks only on certain branches.

Let me know if you want me to create such a file for you. Also, if you need to discuss private/sensitive information relative to your case, don't hesitate to create a support ticket in Mibex' channel (you can reach out via this link).

Best wishes,

Antoine

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events