GitHub: the merge waits for a team's approval (Required reviewers)
The pull request rule of a ruleset can require review or approval from specific teams when a pull request changes certain files or directories: "Required reviewers". Each team has its own number of required approvals from its members and its own list of file patterns, so a pull request that touches those files stays blocked until enough members of that team approve it. For an approval from a team member to count, the team must have write permissions or higher for the repository (GitHub's available rules for rulesets, checked October 26, 2026).
"type": "pull_request",
"parameters": {
"required_reviewers": [
{ "file_patterns": ["src/api/**"], "minimum_approvals": 2,
"reviewer": { "id": 42, "type": "Team" } } ] }
How the rule works
- Teams and approvals: a ruleset can name up to 15 teams, and for each team require from 0 to 10 approvals from its members. Requiring zero approvals adds the team to the pull request for visibility, but the team does not need to approve.
- File patterns: each team has a list of file patterns that decides which files the setting applies to, in the same format as a
.gitignorefile. A pattern starting with an exclamation mark (!) is a negation, and patterns are matched in order, so a negated pattern can "unmatch" files that matched an earlier one. - Whose approval counts: approvals from members of the team, and only when the team has write permissions or higher for the repository.
- Which teams can be chosen: for organization-wide rules, a team of the organization; for repository-level rules, a team of the organization that owns the repository. The rule is not available on user-owned repositories, as they do not contain teams.
- Through the REST API: the rule is
required_reviewersin the parameters of thepull_requestrule, each with itsfile_patterns(fnmatch syntax), itsminimum_approvalsand itsreviewer, a team given by its ID (GitHub's REST API endpoints for rules). "Get rules for a branch" returns the active rules that apply to a branch, whether they are configured on the repository or the organization; rules in rulesets that only evaluate, or are disabled, are not returned. - Where the rule exists: on GitHub.com and GitHub Enterprise Cloud. GitHub's docs list it for GitHub Enterprise Server 3.24 and later (the feature entry in the docs), and the docs for 3.22, the newest Enterprise Server release, have no Required reviewers, so a ruleset on an Enterprise Server may not offer it (required reviewers).
To see which teams still have to approve: Pull Request Inbox for GitHub, a plugin for JetBrains IDEs, names the teams the rulesets require approvals from, with the approvals each needs and the files it covers, in the merge checks of a blocked pull request.
Next to the other review settings
- The same pull request rule: Required reviewers sit in the pull request rule next to the required number of approving reviews, review from code owners, approval of the most recent reviewable push and conversation resolution, and each of those can hold the merge as well.
- Team review assignment: when a team enables auto assignment, any time the team is requested to review a pull request, the team is removed as a reviewer and a subset of its members is assigned in its place, so the pull request may show those members instead of the team (GitHub's managing code review settings for your team).
- Stale approvals: with the option to dismiss stale pull request approvals, GitHub records the diff a reviewer approved. If it changes, for example after a new push, a click on Update branch or a related pull request merged into the target branch, the approving review is dismissed as stale, a team member's too, and the pull request cannot be merged until someone approves the work again (additional settings).
What to do
- Find the rule: anyone with read access to a repository can view its active rulesets (GitHub's about rulesets). In the pull request rule, the Required reviewers list the teams, their approvals and the file patterns; compare them with the files the pull request changes.
- The rules on one branch:
GET /repos/OWNER/REPO/rules/branches/BRANCHreturns all active rules that apply to the branch, whether they are set on the repository or the organization; the branch does not need to exist. Rules in rulesets with the evaluate or disabled enforcement status are not returned (get rules for a branch). - Ask the team: request a review from the team, or from its members, and wait for the number of approvals the rule asks.
- Request the team from the command line:
gh pr edit NUMBER --add-reviewer ORG/TEAM, a team written as in the manual'smyorg/team-name(gh pr edit), orPOST /repos/OWNER/REPO/pulls/NUMBER/requested_reviewerswithteam_reviewers, an array of team slugs; the endpoint sends notifications (request reviewers for a pull request). - Approvals that do not count: if members have approved and the merge still waits, check that the team has write permissions or higher for the repository; whoever manages the repository's access gives it to the team.
- Give the team a role in the settings: people with admin access to the repository manage team access. In the repository's Settings, under Access in the sidebar, click Collaborators & teams, then Add teams; type the team's name, click it in the list, choose a role under Choose a role (Write or higher, for this rule) and click Add NAME to REPOSITORY. For a team already listed, pick a new role in the Role menu next to it (GitHub's inviting a team or person, changing permissions for a team or person and managing team access to an organization repository).
- Access from a parent team: a team's role for a repository can be changed only when the team has direct access. If its access is inherited from a parent team, change the parent team's access; adding or removing access for a parent team also gives it to, or takes it from, each of its child teams (managing team access to an organization repository).
- Check the team's permission:
GET /orgs/ORG/teams/TEAM_SLUG/repos/OWNER/REPOanswers 204 when the team has any permission for the repository, from pull to admin, and 404 when it has none; repositories inherited through a parent team are checked too. With the Accept headerapplication/vnd.github.v3.repository+jsonit answers 200 with the permissions the team grants, wherepushis write (check team permissions for a repository). - Give it through the REST API:
PUT /orgs/ORG/teams/TEAM_SLUG/repos/OWNER/REPOwith{"permission": "push"}gives the team the write role and answers 204. The permission can bepull,triage,moderate,push,maintain,adminor the name of a custom repository role of the organization; without it, the team's permission attribute decides. The caller needs admin access to the repository and must be able to see the team. The repository must be owned by the organization or be a direct fork of one, and adding a repository the organization does not own answers 422 (add or update team repository permissions). - The team should not cover these files: whoever manages the ruleset narrows the team's file patterns (a negated pattern can leave files out), or sets its approvals to zero so the team is only added for visibility.
- Merge with a bypass: a ruleset can let users with certain roles, specific teams or GitHub Apps bypass its rules. In the REST API each bypass actor has a
bypass_mode:always(the default),pull_request, which bypasses the rules on pull requests only, orexempt, for which the rules are not run and no bypass audit entry is created (granting bypass permissions, create a repository ruleset).
In IntelliJ IDEA: approvals are counted, not matched to the team
Checked in the IntelliJ IDEA source on October 31, 2026: pullRequestMergeability.graphql, refUpdateRule.graphql, GHPRMergeabilityStateBuilder.kt, GHPRReviewFlowViewModelImpl.kt, GraphQL files, GithubApiRequests.kt.
For the base branch, the IDE asks GitHub for these fields of the rule:
fragment refUpdateRule on RefUpdateRule {
allowsDeletions
allowsForcePushes
pattern
requiredApprovingReviewCount
requiredStatusCheckContexts
requiresLinearHistory
requiresSignatures
viewerCanPush
}
The only one about approvals is requiredApprovingReviewCount, one number. None of its 78 GraphQL files asks for requiredReviewers (the team, file patterns and minimum approvals of the pull request rule), for rulesets or for a team's members, and its list of REST requests has none for them either.
It keeps that number only while GitHub reports the merge as blocked, the account may push to the branch and every required check has succeeded (or none is required); otherwise it uses 0.
For its own review state, it counts the reviewers whose review is an approval. If that count reaches the number (with 0, a single approval), the state is accepted; otherwise the state follows GitHub's reviewDecision. It does not check whether an approval came from the required team. A team is requested by its slug (a team review request was replaced by team members).
GitHub pull requests in IntelliJ IDEA
Pull Request Inbox for GitHub, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, shows a pull request's reviews, checks and conversations next to the diff, and merges it with the methods the target branch allows. When a pull request is blocked, its merge checks say when a review is still required and name the code owners asked to review, and when the branch's rulesets require approvals from teams for certain files, they name those teams with the approvals each needs and the files it covers (a team by its ID once it is no longer asked to review). The review inbox, diffs and conversations are free; approving, commenting, resolving and merging are Pro (US$1.50 a month, with a 30-day trial).
Get it on JetBrains Marketplace
GitHub is a trademark of GitHub, Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by GitHub, Inc. or JetBrains.
More: GitHub merge refused (405, 409) · GitHub review refused (422) · GitHub search 422 "Validation Failed" · "Resource not accessible by personal access token" · 401 "Bad credentials" · "Resource protected by organization SAML enforcement" · "API rate limit exceeded" · GitHub diff 406 "too_large", 3,000 files · GitHub line comment 422 "must be part of the diff" · GitHub branch update refused (422) · GitHub pull request not created (422, 403) · GitHub auto-merge refused · GitHub draft, ready for review or close refused · GitHub conversation not resolved · GitHub checks not shown (check runs 403) · GitHub file contents not read · GitHub compare refused (404, 422) · GitHub comment or reply refused (403 locked, archived) · GitHub merge method not allowed (405) · GitHub branch not found (404, 301) · GitHub Enterprise Server not reached · GitHub review request not shown · GitHub pull request list incomplete · GitHub 404 Not Found, renamed repositories (301, 307) · GitHub line comment outdated or not on the diff · GitHub pull requests not updating, notifications late · GitHub suggested change cannot be applied · GitHub required check stuck at "Expected" · GitHub code owner review required · GitHub merge blocked by unresolved conversations · GitHub merge blocked by unsigned commits · GitHub branch that merges through a merge queue · GitHub merge waiting for an approval of the most recent push · GitHub merge waiting for code scanning results · GitHub merge waiting for code quality results · GitHub merge blocked by a code coverage threshold · GitHub merge blocked by license compliance results · GitHub branch locked or its updates restricted · GitHub branch not deleted after merging · GitHub merge blocked by secret scanning alerts · GitHub stacked pull request not merging · GitHub push blocked by push rules · GitHub merge blocked by commit metadata rules · GitHub force push blocked · GitHub issue not closed by a merged pull request · GitHub pull request not checked out locally · GitHub pull request has merge conflicts · GitHub changes requested and dismissing a review · GitHub co-author not credited for a commit · GitHub dependency review check failed · GitHub Dependabot not rebasing its pull request · GitHub fork not syncing with upstream · GitHub pull request base branch not changing · GitHub pull request not reverting · GitHub pull request template not showing · GitHub pull request labels or assignees not added · GitHub pull request not closing or reopening · GitHub push blocked by push protection · GitHub pull request comment hidden · GitHub pull request blocked until deployments succeed · GitHub team review request replaced by members · GitHub pull request file no longer marked Viewed · GitHub pull request marked merged without being merged · GitHub Copilot review does not count as an approval · GitHub checks not running on a pull request a workflow created · GitHub Update branch button not shown on a pull request · GitHub checks failing on a Dependabot pull request · GitHub checks failing on a pull request from a fork · GitHub checks skipped by [skip ci] in a commit message · GitHub checks gone after the retention period · GitHub code review limits in a public repository · GitHub pull requests turned off or limited in a repository · GitHub checks run on every pull request in a stack · GitHub pull request showing commits already squash merged · GitHub pull request not showing a file diff · GitHub push to a pull request branch from a fork refused · GitHub check cancelled on a pull request · GitHub Rebase and merge not available · GitHub merge commit message not what you expected · GitHub pull request shows every line changed · GitHub API request timed out · GitHub pull request image or document diff not shown · GitHub review request refused (422) · GitHub pull request from Copilot: checks not running, approval not counted · GitHub push refused: GH006 and GH013 on a protected branch · GitHub "At least 1 approving review is required", approvals that do not count · GitHub pull request plugins for IntelliJ IDEA, compared · 日本語