Skip to main content

Update pull request review protection

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Updating pull request review enforcement requires admin or owner permissions to the repository and branch protection to be enabled. **Note**: Passing new arrays of `users` and `teams` replaces their previous values.

PATCH/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews
Source
github-v3-rest.json
Revision
f5f067c1e6f6
Active snapshot
85e53e3d0d65

Request

Path Parameters
owner string
required
repo string
required
branch string
required

The name of the branch.

Body Params
optional
application/jsonobject
dismiss_stale_reviews boolean
optional

Set to `true` if you want to automatically dismiss approving reviews when someone pushes a new commit.

dismissal_restrictions object
optional

Specify which users and teams can dismiss pull request reviews. Pass an empty `dismissal_restrictions` object to disable. User and team `dismissal_restrictions` are only available for organization-owned repositories. Omit this parameter for personal repositories.

teams array[string]
optional

The list of team `slug`s with dismissal access

users array[string]
optional

The list of user `login`s with dismissal access

require_code_owner_reviews boolean
optional

Blocks merging pull requests until [code owners](https://docs.github.com/articles/about-code-owners/) have reviewed.

required_approving_review_count integer
optional

Specifies the number of reviewers required to approve pull requests. Use a number between 1 and 6.

Responses

application/json Protected Branch Pull Request Review object

Response

dismiss_stale_reviews boolean
required

Example: true

dismissal_restrictions object
optional
teams array[Team object]
optional

The list of teams with review dismissal access.

items Team object

Groups of organization members that gives permissions on specified repositories.

description string
requirednullable
html_url string<uri>
required

Example: https://github.com/orgs/rails/teams/core

id integer
required
members_url string
required
name string
required
node_id string
required
parent Team Simple object
requirednullable

Groups of organization members that gives permissions on specified repositories.

permission string
required
permissions object
optional
privacy string
optional
repositories_url string<uri>
required
slug string
required
url string<uri>
required
teams_url string
optional
Example:
"https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions/teams"
url string
optional
Example:
"https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions"
users array[Simple User object]
optional

The list of users with review dismissal access.

items Simple User object

Simple User

avatar_url string<uri>
required

Example: https://github.com/images/error/octocat_happy.gif

email string
optionalnullable
events_url string
required

Example: https://api.github.com/users/octocat/events{/privacy}

followers_url string<uri>
required

Example: https://api.github.com/users/octocat/followers

following_url string
required

Example: https://api.github.com/users/octocat/following{/other_user}

gists_url string
required

Example: https://api.github.com/users/octocat/gists{/gist_id}

gravatar_id string
requirednullable

Example: 41d064eb2195891e12d0413f63227ea7

html_url string<uri>
required

Example: https://github.com/octocat

id integer
required

Example: 1

login string
required

Example: octocat

name string
optionalnullable
node_id string
required

Example: MDQ6VXNlcjE=

organizations_url string<uri>
required

Example: https://api.github.com/users/octocat/orgs

received_events_url string<uri>
required

Example: https://api.github.com/users/octocat/received_events

repos_url string<uri>
required

Example: https://api.github.com/users/octocat/repos

site_admin boolean
required
starred_at string
optional

Example: "2020-07-09T00:17:55Z"

starred_url string
required

Example: https://api.github.com/users/octocat/starred{/owner}{/repo}

subscriptions_url string<uri>
required

Example: https://api.github.com/users/octocat/subscriptions

type string
required

Example: User

url string<uri>
required

Example: https://api.github.com/users/octocat

users_url string
optional
Example:
"https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions/users"
require_code_owner_reviews boolean
required

Example: true

required_approving_review_count integer
optional

Example: 2

url string<uri>
optional
Example:
https://api.github.com/repos/octocat/Hello-World/branches/master/protection/dismissal_restrictions
application/json Validation Error object

Validation failed

documentation_url string
required
errors array[object]
optional
items object
code string
required
field string
optional
index integer
optional
message string
optional
resource string
optional
value
optional
message string
required