CODEOWNERS file with a NOT file type condition

Hi,

Is there a way, in which I can specify the CODEOWNERS file that assigns file types with a NOT condition. Meaning, I would like to be able to request a PR review to from a member with write access to all files except .md for example.

I am referring this article: https://help.github.com/articles/about-codeowners/#codeowners-syntax 

Thanks.

Thanks for asking.

It’s not possible to use negative patterns in your CODEOWNERS file. Attempting to do so will currently make us unable to parse the rest of the file.

HI @lee-dohm, you should update the documentation regarding the CODEOWNERS file since this:

> A CODEOWNERS file uses a pattern that follows the same rules used in gitignore files. 

isn’t necessarily true given that negative patterns aren’t supported and from my experience neither are the use of brackets ([]) to denote a range of characters. In fact these break the functionality due to what you mentioned, you’re unable to parse the rest of the file.

15 Likes

When will this be fixed? Our project uses [and] in file names, and cannot use the Codeowners functionality at all now.

You can do the following:

* @a_real_developer
*.md @ghost

GitHub will parse the CODEOWNERS file from top to bottom, and thus for all files except Markdown files, the code owner will be @a_real_developer, but for Markdown files it will be @ghost. The trick is that GitHub does not request reviews from users who are not collaborators nor organization members, so @ghost will never receive a review request, and this amounts to “no one”.

5 Likes

But what will happen if the box “require codeowners review” is ticked?

This does not seem to work any more.