CODEOWNERS - Different files

I am using GHE.
I have 3 files config/dev.json, config/qa.json, config/prd.json
I need to setup CODEOWNER for config/dev.json and config/qa.json to team-A and
config/prd.json to team-B
I defined the CODEOWNERS file as

config/dev.json team-A
config/qa.json team-A
config/prd.json team-B

If there is a PR with config/qa.json and config/prd.json changes, CODEOWNER gets applied as team-A . How should i make sure that if config/prd.json is under change (along with other files), I want team-B to be assigned as CODEOWNER.

Is this possible?

Hi rangarb! :wave: Welcome to the Community!

The rules in the CODEOWNERS file work a little like CSS, in that matches further down the file (which are usually written to be more specific than matches higher up the file) take precedence.

In this case, as your rules are very specific, I would expect both team-A and team-B to be added as reviewers to a PR that alters both config/qa.json and config/prd.json.

Can you confirm that both teams have been explicitly given write access or above to the repository?

Also, do the teams share any members? It’s worth pointing out that when one member of a team responds, they are assigned on behalf of the whole team, cancelling the requirement for the rest of the team. If one person from team-A responded and they were also a member of team-B, they would fulfill both requirements.

Another thing to check - are you using automatic code review assignment? If so, that would de-select the team, and pick out specific individuals to do reviews instead!