As a maintainer of a repository, it’s in your best interest to automate processes as much as possible. The CODEOWNERS file is one of those tools to...
For further actions, you may consider blocking this person and/or reporting abuse
Do you know whether or not this is something that can work if placed in the specially named .github repository to serve as a default for all repositories that you own that don't otherwise have it? The way you can with templates for pull requests and issues, as well as contributing guidelines, security policies, etc.?
That’s a great question. I’m not sure, but I feel like it would.
The only problem is GitHub grabs the first one it finds so there’s no merging or inheritance for CODEOWNER files, so if it was global, every repository would always have the same code owners.
If it works, then I think it would probably work the way other stuff in that repository works, global across all repositories you own, but if an individual repository also has it then the local one takes precedence. I might just try it. I don't currently have a CODEOWNERS file in any of my repositories. So as easy to try in my .github repo as in any other.
Awesome. Let me know how it goes and I can update the article if you can override that global one.
I just tried it from my .github repository. It doesn't work from there at all. So it looks like it is limited to configuration within a single repository.
Oh well. Thanks for giving it a go!
A simple file, but very useful!
Merci Thomas!
This is supported by most big VCS cloud platforms, like GitLab, etc.
I think only Bitbucket doesn't support it directly - but there's a free plugin in the Atlassian marketplace which does the same thing.
Yeah, I knew GitLab supported it, just wasn’t aware of the Atlassian plugin. Thanks for sharing!
Really nice article, Nick :)
Perhaps you could add a paragraph that explains how to add path-based rules (or other patterns) to CODEOWNERS. It is very useful for mono-repos and scenarios, where several teams manage and own different parts of the code, like the Infra team owns the
/infra
directory with Terraform code, while the app team owns the/src
directory with the application code.Thanks for the kind words, David. This was more of a primer, but happy to add this to make it a bit of a deeper dive. Thanks for the feedback!
Great article @nickytonline !
I was first introduced to the Codeowners file a few years ago with freeCodeCamp's main repo
github.com/freeCodeCamp/freeCodeCa...
But now, I am thinking of adding it to other repos I help maintain :)
Noice!
Excellent article! Such an important aspect of DevSecOps. We use arnica.io to automate our code owners management. Check it out: arnica.io/blog/what-every-develope...
Amazing! I'm glad to know people learned something new because I shared what I didn't know!
I just learned about this file a few weeks back from @danieltott! I haven't had time to explore, so thanks for sharing, @nickytonline 🙌🏼😄
This is very useful, thanks for sharing your knowledge with us!
Glad you found it helpful Emmanuel!
Nice, I didn't know about this file but this is great for automating the reviewer process so the specific code owner is notified. This is great, thanks!
Glad you found it helpful!
Excelent article, i don't have project nor a team. So, i can't take advantage of the situation.
Well if you get around to creating a project, you can add yourself to start and then maybe in the future others will become maintainers that can be added as well. 😎