---
title: "Required reviewers in a ruleset or CODEOWNERS: which to use? | Proofline"
description: "Use a ruleset's required reviewers rule when a path needs a set number of approvals from specific teams, or exclusions by negation."
url: https://proofline.sh/learn/ruleset-required-reviewers-by-path/
---

[Learning center](/learn/)

# Required reviewers in a ruleset or CODEOWNERS: which to use?

Use a ruleset's required reviewers rule when a path needs a set number of approvals from specific teams, or exclusions by negation. Keep CODEOWNERS for routing review requests to the people who know the code. The rule lives outside the repository, so a pull request cannot edit it.

Code review The Proofline team November 23, 2026 5 min read

## What the rule does

The required reviewers rule is part of a ruleset's "Require a pull request before merging" rule. It lets you "require review or approval from specific teams when a pull request changes certain files or directories. You can specify up to 15 different teams, and for each team you can require a certain number of approvals from team members." Approvals per team range "from 0 (zero) to 10," and zero "means that the team will be added for visibility, but the team does not need to approve the request." For a team member's approval to count, "the team must have write permissions (or higher) for the repository." [Required reviewers](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets#required-reviewers)

Each team gets its own list of file patterns. The rulesets page says the list uses "the same as a standard `.gitignore` file" format, with negation: "A pattern starting with an exclamation mark (`!`) is a negation. This will cause paths matching earlier patterns to _not_ require approvals," and "Patterns are matched in order." The REST reference describes the same field as using "fnmatch syntax." [Create a repository ruleset](https://docs.github.com/en/rest/repos/rules#create-a-repository-ruleset) The two pages differ, so test any pattern beyond plain `**` and `*` on a real pull request before you depend on it.

The rule entered public preview in November 2025 and became generally available on 17 February 2026, with negation patterns added since the preview. [Required review by specific teams changelog](https://github.blog/changelog/2025-11-03-required-review-by-specific-teams-now-available-in-rulesets/), [Required reviewer rule changelog](https://github.blog/changelog/2026-02-17-required-reviewer-rule-is-now-generally-available/) It names teams, so it "is not available on user-owned repositories as they do not contain teams."

## How it differs from CODEOWNERS

|  | CODEOWNERS with required code owner review | Ruleset required reviewers |
| --- | --- | --- |
| Who can be named | Users, teams or email addresses | Teams only, up to 15 per rule |
| What satisfies a path | One approval from any owner on the last matching line | The set number of approvals from each listed team |
| Two teams on one path | Not expressible; either team's approval suffices | Each team has its own entry and count |
| Exclusions | A later line with no owners; `!` does not work | `!` negation in the pattern list |
| Where it is defined | A file on the base branch, changed by pull request | Ruleset settings, changed by people who can edit rules |
| Scope | One branch of one repository | A repository, or many through organization or enterprise rulesets |
| Requests review without requiring it | Yes, this is its default behavior | Yes, with zero required approvals |

The documentation for the first column is on [About code owners](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners). GitHub's changelog describes the split directly: "While CODEOWNERS defines ownership, this rule focuses on policy enforcement," and "The required reviewer rule augments CODEOWNERS files but doesn't replace them. CODEOWNERS files remain the best way to manage ownership, support individuals as reviewers, and request reviews even when not required."

The "where it is defined" row is the one that changes what a pull request can do. A CODEOWNERS file is code: a pull request can propose removing a team, and the change takes effect once it merges, which is why [the file needs its own owner](/learn/codeowners-owner-of-the-codeowners-file/). A ruleset is changed by repository administrators or roles with the "edit repository rules" permission, outside any pull request.

## A fictional policy written both ways

Suppose the fictional `acme/payments-api` repository wants two rules, taken from the examples in GitHub's changelog: `*.sql` changes need a review from the data platform team, and authentication code needs two reviews from the security team. The security team does not want to review Markdown in the authentication directory.

CODEOWNERS can route the requests:

```
*                    @acme/payments
**/*.sql             @acme/data-platform
/services/auth/      @acme/security
```

With **Require review from Code Owners** on, this gets one approval from `@acme/security` on authentication changes, not two. A `.sql` file inside `services/auth/` matches the auth line last, so the data platform team is not requested for it. There is no way to exclude `services/auth/**/*.md` except an override line per file pattern, and `!` does not work in CODEOWNERS.

The ruleset version, as the REST API accepts it for `POST /repos/acme/payments-api/rulesets`:

```
{
  "name": "payments review policy",
  "target": "branch",
  "enforcement": "active",
  "conditions": { "ref_name": { "include": ["~DEFAULT_BRANCH"], "exclude": [] } },
  "rules": [
    {
      "type": "pull_request",
      "parameters": {
        "required_approving_review_count": 1,
        "dismiss_stale_reviews_on_push": true,
        "require_code_owner_review": false,
        "require_last_push_approval": false,
        "required_review_thread_resolution": false,
        "required_reviewers": [
          {
            "reviewer": { "id": 3333333, "type": "Team" },
            "minimum_approvals": 2,
            "file_patterns": ["services/auth/**", "!services/auth/**/*.md"]
          },
          {
            "reviewer": { "id": 4444444, "type": "Team" },
            "minimum_approvals": 1,
            "file_patterns": ["**/*.sql"]
          }
        ]
      }
    }
  ]
}
```

Here the two entries are independent. A `.sql` file under `services/auth/` needs two security approvals and one data platform approval, and a README change in the auth directory needs neither. The CODEOWNERS file stays in place for review requests and for the [ownership tooltip](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#about-code-owners), with `require_code_owner_review` off so the two policies do not double up. If you leave both on, "all applicable rules are enforced," as with any layered rules. [About rulesets](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets#about-rulesets-and-protected-branches)

## What neither catches

Both mechanisms count approvals from people with write access. Neither shows that the approver read the diff, and neither can tell an authentication change that matters from one that renames a variable. A path pattern also misses risky changes that live elsewhere: an authentication flag flipped in a shared configuration file is outside `services/auth/**`.

## The cost

Two required security approvals on every authentication change is a standing queue for that team. Zero-approval entries are a cheaper first step: the team is added to matching pull requests and sees the traffic before you decide what to require. Organization and enterprise rulesets reach many repositories at once, so a broad pattern there can block merges across the organization. Rulesets have an Evaluate status for trying rules first, but the REST reference notes "evaluate is only available with GitHub Enterprise." [Create a repository ruleset](https://docs.github.com/en/rest/repos/rules#create-a-repository-ruleset)

## Which to use

Use CODEOWNERS when one owner's approval per path is enough, when owners include individuals, or when you only want review requests. Use the ruleset rule when a path needs a count above one from a specific team, approval from two teams, an exclusion inside a directory, or the same policy across repositories, as [the guide to multiple owners](/learn/codeowners-any-owner-approves/) shows. Keep the patterns narrow, start sensitive teams at zero required approvals, and raise the count once you have seen what the pattern catches. Several rulesets can apply to one branch, so check how a new one [layers with existing branch protection](/learn/rulesets-and-branch-protection-together/).

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Does every owner on a CODEOWNERS line have to approve?](/learn/codeowners-any-owner-approves/)
    
    Code review The Proofline team November 23, 2026 4 min read
    
-   ### [How do rulesets and branch protection rules combine?](/learn/rulesets-and-branch-protection-together/)
    
    Code review The Proofline team November 23, 2026 5 min read
