PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews

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 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.

Servers

Path parameters

Name Type Required Description
repo String Yes

The name of the repository without the .git extension. The name is not case sensitive.

branch String Yes

The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.

owner String Yes

The account owner of the repository. The name is not case sensitive.

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
dismiss_stale_reviews Boolean No

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

dismissal_restrictions Object No

Specify which users, teams, and apps 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.

dismissal_restrictions.teams[] Array No

The list of team slugs with dismissal access

dismissal_restrictions.apps[] Array No

The list of app slugs with dismissal access

dismissal_restrictions.users[] Array No

The list of user logins with dismissal access

bypass_pull_request_allowances Object No

Allow specific users, teams, or apps to bypass pull request requirements.

bypass_pull_request_allowances.teams[] Array No

The list of team slugs allowed to bypass pull request requirements.

bypass_pull_request_allowances.apps[] Array No

The list of app slugs allowed to bypass pull request requirements.

bypass_pull_request_allowances.users[] Array No

The list of user logins allowed to bypass pull request requirements.

required_approving_review_count Integer No

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

require_last_push_approval Boolean No

Whether the most recent push must be approved by someone other than the person who pushed it. Default: false

Default value: false

require_code_owner_reviews Boolean No

Blocks merging pull requests until code owners have reviewed.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.