pr_review_protection
Creates, updates, deletes, gets or lists a pr_review_protection resource.
Overview
| Name | pr_review_protection |
| Type | Resource |
| Id | github.repos.pr_review_protection |
Fields
The following fields are returned by SELECT queries:
- get_pull_request_review_protection
Response
| Name | Datatype | Description |
|---|---|---|
bypass_pull_request_allowances | object | Allow specific users, teams, or apps to bypass pull request requirements. |
dismiss_stale_reviews | boolean | |
dismissal_restrictions | object | |
require_code_owner_reviews | boolean | |
require_last_push_approval | boolean | Whether the most recent push must be approved by someone other than the person who pushed it. |
required_approving_review_count | integer | |
url | string (uri) | (example: https://api.github.com/repos/octocat/Hello-World/branches/master/protection/dismissal_restrictions) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_pull_request_review_protection | select | owner, repo, branch | 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. | |
update_pull_request_review_protection | update | owner, repo, branch | 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. | |
delete_pull_request_review_protection | delete | owner, repo, branch | 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. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
branch | string | The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API. |
owner | string | The account owner of the repository. The name is not case sensitive. |
repo | string | The name of the repository without the .git extension. The name is not case sensitive. |
SELECT examples
- get_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 in the GitHub Help documentation.
SELECT
bypass_pull_request_allowances,
dismiss_stale_reviews,
dismissal_restrictions,
require_code_owner_reviews,
require_last_push_approval,
required_approving_review_count,
url
FROM github.repos.pr_review_protection
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND branch = '{{ branch }}' -- required
;
UPDATE examples
- 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 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.
UPDATE github.repos.pr_review_protection
SET
dismissal_restrictions = '{{ dismissal_restrictions }}',
dismiss_stale_reviews = {{ dismiss_stale_reviews }},
require_code_owner_reviews = {{ require_code_owner_reviews }},
required_approving_review_count = {{ required_approving_review_count }},
require_last_push_approval = {{ require_last_push_approval }},
bypass_pull_request_allowances = '{{ bypass_pull_request_allowances }}'
WHERE
owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND branch = '{{ branch }}' --required
RETURNING
bypass_pull_request_allowances,
dismiss_stale_reviews,
dismissal_restrictions,
require_code_owner_reviews,
require_last_push_approval,
required_approving_review_count,
url;
DELETE examples
- delete_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 in the GitHub Help documentation.
DELETE FROM github.repos.pr_review_protection
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND branch = '{{ branch }}' --required
;