Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding codeowners for files in the root directory only

If I have a project structured like this:

project
│   README.md
│   config.json
    package.json
│
└───folder1
│   │   fileA.js
│   │   fileB.html
│   
└───folder2
    │   fileC.js
    │   fileD.html

How can I add a rule to the CODEOWNERS file that gives a user ownership of only the files in the root folder, but not the files in any of the subdirectories?

I've tried the following but none of them seem to work the way I want:

# CODEOWNERS
/ @johnSmith

./ @johnSmith

/* @johnSmith
like image 321
David Avatar asked Jun 28 '26 09:06

David


1 Answers

After some experimenting this seems to work:

#CODEOWNERS

/*.* @userName

/apps @differentUserName

That will give @userName ownership of root files. It also applies to files inside dot-prefix folders, like .github/ or .vscode/ but no other nested directories

like image 184
David Avatar answered Jun 30 '26 17:06

David



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!