In GitHub we have:
- Two teams, say TeamA and TeamB.
- Three repos: RepoA, RepoB and RepoCommon.
TeamA works mostly in RepoA, TeamB in RepoB and they share code in RepoCommon. A minimum of two reviewers are required for a PR in any repo. (The real-world use-case is iOS, Android and Kotlin Multiplatform shared code but I'll stick with A and B to keep it generic).
We'd like to have:
- Two reviewers from TeamA assigned to any PR in RepoA
- Two reviewers from TeamB assigned to any PR in RepoB
- One reviewer from TeamA and one reviewer from TeamB assigned to any PR in RepoCommon
By setting the Required Reviewers number for each team to 2, and adding both teams to the CODEOWNERS file (i.e. * @TeamA @TeamB) the common PRs get assigned 4 reviewers, preferentially showing only two from whichever team happens to be first in CODEOWNERS. If we set the Required Reviewers to 1 the Common repo receives the correct number but the team-specific repositories only receive a single reviewer. How can we have the best of both worlds?