Where is the logic how CODEOWNERS works on auto assigning?

I’d like to ask the situation when PR matches multiple distinguished rules. Said that we have a CODEOWNERS files like:

*.js @foo @bar
docs/ @bar @baz

If someone make a PR touches both JS files and docs folder, is GitHub choose only @bar as the reviewer, or it must require two different reviewers, or some other behavior?

And further, I don’t see a detailed spec describes all these cases how CODEOWNERS file would work. Please DO NOT send me this links, they roughly say little about details. If I want to use it, I’d like to understand most of its behaviors.

2 Likes

Order is important; the last matching pattern takes the most
precedence.

That’s a bit unclear documented in the comments of the example file:
https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-code-owners#example-of-a-codeowners-file

Since GitHub Docs are now OS, you can create a suggestion for this docs.

1 Like

What if there is nothing about order, I mean, a PR touch

root.js
docs/mydoc.md

It is my case. Possibly a PR may touch a wide range of file and I’d like to merge CODEOWNERS as many as possible, so that less people be notified (disturbed).

1 Like

I don’t really understand what you mean.
Just read the comments from the mentioned example file.

1 Like

Order is important; the last matching pattern takes the most precedence.

works for one sort of matches, but what if I have two sort of matches.