What the requirement counts#
GitHub's documentation is explicit: "When reviews from code owners are required, an approval from any of the owners is sufficient to meet this requirement." Its example line is *.js @global-owner1 @global-owner2, which "means that changes to JavaScript files could be approved by either @global-owner1 or @global-owner2, but approvals from both are not required." CODEOWNERS and branch protection The rulesets page repeats it for the ruleset version of the setting: "if code has multiple owners, an approval from any of the code owners will be sufficient." Require a pull request before merging
Writing a second line does not help. "If you want to match two or more code owners with the same pattern, all the code owners must be on the same line. If the code owners are not on the same line, the pattern matches only the last mentioned code owner." CODEOWNERS syntax Two lines for the same path leave only the second team as owner.
Raising the repository's required approval count to two does not help either. The count is about how many approving reviews from people with write access the pull request has, not which teams they come from, so two members of one team meet it.
Terraform: a core team on every line#
HashiCorp's Terraform CODEOWNERS pairs the core team with a specialist team on many lines. hashicorp/terraform CODEOWNERS, read on 2026-11-23.
/internal/backend/remote-state/azure @hashicorp/terraform-core @hashicorp/terraform-azure
/internal/backend/remote-state/s3 @hashicorp/terraform-core @hashicorp/terraform-aws
/internal/cloud @hashicorp/terraform-core @hashicorp/tf-core-cloud
Under required code owner review, an approval from any member of @hashicorp/terraform-core satisfies the requirement for the S3 backend, and the AWS team's approval is not needed. Both teams are requested, so the AWS team sees the change, but the merge does not wait for it. Whether that is the intent is a choice only the project can state. The structure fits a project that wants the core team able to land changes everywhere and the specialists informed.
A fictional case where any-of is the wrong rule#
Suppose the fictional acme/shop repository wants infrastructure changes reviewed by both the platform team, for how they run, and the security team, for what they expose. Someone writes:
/infra/terraform/ @acme/platform @acme/security
A platform engineer opens a pull request that opens a security group to 0.0.0.0/0 on a new port. A teammate on @acme/platform approves. The code owner requirement is satisfied, and the pull request can merge with nobody from @acme/security having looked. CI ran terraform plan and the plan succeeded, because the change is valid; whether it should be made is the question the security review was meant to answer.
The line expresses "either team may approve," and the repository needed "both teams must approve."
Requiring each team#
The ruleset rule for required reviewers expresses "each of these teams." It lets you "require review or approval from specific teams when a pull request changes certain files or directories," with "up to 15 different teams," and "for each team you can require a certain number of approvals from team members." Required reviewers For the fictional repository, the pull_request rule of a branch ruleset would carry two entries, one per team, as the REST API accepts them. Team IDs come from gh api orgs/acme/teams/TEAM_SLUG --jq .id:
{
"type": "pull_request",
"parameters": {
"required_approving_review_count": 1,
"dismiss_stale_reviews_on_push": true,
"require_code_owner_review": true,
"require_last_push_approval": false,
"required_review_thread_resolution": false,
"required_reviewers": [
{
"reviewer": { "id": 1111111, "type": "Team" },
"minimum_approvals": 1,
"file_patterns": ["infra/terraform/**"]
},
{
"reviewer": { "id": 2222222, "type": "Team" },
"minimum_approvals": 1,
"file_patterns": ["infra/terraform/**"]
}
]
}
}
The field names come from the REST reference for creating a repository ruleset. Create a repository ruleset The rule needs teams, so it "is not available on user-owned repositories," and each team must have write access for its members' approvals to count. Requiring reviewers by path with a ruleset compares the rule with CODEOWNERS in full.
What any-of does not catch#
Even with both teams required, an approval records that someone with write access on each team clicked approve on that diff. It does not show what they read. Authors cannot approve their own pull requests, so a team whose only active member is the author cannot satisfy either rule. Approving a pull request with required reviews
The cost of requiring both#
Each extra required team adds a wait for the slowest of them, on every pull request in the path. Applied to a whole directory, the security team in the example would be asked to approve variable renames and comment fixes in Terraform files. Keep the two-team rule to the paths where the second team's question applies, and narrow the patterns, such as files that define network or identity resources, rather than the whole infrastructure tree. How many approvals to require covers the count itself.
Choose the rule by the sentence you mean#
If the sentence is "any of these people may approve," list them on one CODEOWNERS line. That suits a backup owner for a specialist team, or a core team that may land changes anywhere. If the sentence is "each of these teams must approve," CODEOWNERS cannot say it; add a required reviewers entry per team in a ruleset, and keep CODEOWNERS for routing review requests.