Code Owners Review Settings
In the repository settings, you can configure the CODEOWNERS review behavior in more detail. You can find the following options by going to "Repository Settings → Pull Requests → CODEOWNERS Review Settings".
Setting Description
Review Counting Mode
Set how CODEOWNERS reviews count towards the minimum number of required reviews.
| Mode | Description |
|---|---|
| Merge Counting Mode | The number of CODEOWNERS reviews is combined with the number of regular reviews |
| Independent Counting Mode | CODEOWNERS reviews are not counted towards the total number of reviews, and regular reviews are counted separately |
Code Owner Collaboration Approval Mode
Control the approval logic when multiple owners are assigned in CODEOWNERS rules.
| Mode | Description |
|---|---|
| Enabled | A rule is considered passed if any one of the Code Owners approves |
| Disabled | All Code Owners must approve for a rule to pass |
Gate Pass Judgment Logic
The gate pass judgment is divided into two steps:
Step 1: Whether the CODEOWNERS rules pass
Determined by the "Collaboration Approval Mode":
| Collaboration Approval | Rule Pass Condition |
|---|---|
| Enabled | Any Owner approves |
| Disabled | All Owners approve |
If the CODEOWNERS rules do not pass → The gate is directly denied, and the second step will not be checked.
Step 2: Whether the number of reviews meets the requirement
Determined by the "Counting Mode" (provided that the first step has passed):
| Counting Mode | Satisfy Condition |
|---|---|
| Merge Counting | Number of CODEOWNERS reviews + Number of regular reviews ≥ Minimum required reviews |
| Independent Counting | Number of regular reviews ≥ Minimum required reviews |
Setting Combination Effects
Example Scenario
CODEOWNERS File:
*.js @user1 @user2
PR Changes: Modified app.js
Minimum Required Reviews: 2
Combination Effect Table
| Collaboration Approval | Counting Mode | CODEOWNERS Rule | Review Situation | Gate Result | Explanation |
|---|---|---|---|---|---|
| Enabled | Merge Counting | @user1 approved | CODEOWNERS 1 person + Regular 1 person | Pass | 1+1=2 ≥ 2 |
| Enabled | Merge Counting | @user1 approved | CODEOWNERS 1 person + Regular 0 person | Not Pass | 1+0=1 < 2 |
| Enabled | Merge Counting | @user1 and @user2 both approved | CODEOWNERS 2 persons + Regular 0 person | Pass | 2+0=2 ≥ 2 |
| Enabled | Independent Counting | @user1 approved | Regular 2 persons | Pass | Regular 2 ≥ 2 |
| Enabled | Independent Counting | @user1 approved | Regular 1 person | Not Pass | Regular 1 < 2 |
| Disabled | Merge Counting | @user1 and @user2 both approved | CODEOWNERS 2 persons + Regular 0 person | Pass | 2+0=2 ≥ 2 |
| Disabled | Merge Counting | @user1 and @user2 both approved | CODEOWNERS 2 persons + Regular 1 person | Pass | 2+1=3 ≥ 2 |
| Disabled | Merge Counting | @user1 approved, @user2 not approved | - | Not Pass | Premise not met, directly denied |
| Disabled | Independent Counting | @user1 and @user2 both approved | Regular 2 persons | Pass | Regular 2 ≥ 2 |
| Disabled | Independent Counting | @user1 approved, @user2 not approved | - | Not Pass | Premise not met, directly denied |
Applicable Scenarios
| Combination | Applicable Scenario |
|---|---|
| Collaboration + Merge Counting | Team collaboration, flexible review: CODEOWNERS rules per line require minimal number, combined with regular reviews |
| Collaboration + Independent Counting | Clear division of labor: CODEOWNERS rules pass, regular reviews need to meet the number requirement |
| Non-collaboration + Merge Counting | Strict review for critical code: all Owners must approve, can be combined with regular reviews |
| Non-collaboration + Independent Counting | Completely separated: all Owners must approve, regular reviews also need to meet the number requirement |