Skip to main content

branch_protection

Overview

Namebranch_protection
TypeResource
Idgithub.repos.branch_protection

Fields

NameDatatypeDescription
namestring
block_creationsobject
lock_branchobjectWhether to set the branch as read-only. If this is true, users will not be able to push to the branch.
allow_fork_syncingobjectWhether users can pull changes from upstream when the branch is locked. Set to true to allow fork syncing. Set to false to prevent fork syncing.
restrictionsobjectBranch Restriction Policy
urlstring
required_signaturesobject
allow_force_pushesobject
required_pull_request_reviewsobjectProtected Branch Pull Request Review
allow_deletionsobject
enabledboolean
enforce_adminsobjectProtected Branch Admin Enforced
required_linear_historyobject
required_conversation_resolutionobject
required_status_checksobjectProtected Branch Required Status Check
protection_urlstring

Methods

NameAccessible byRequired ParamsDescription
get_branch_protectionSELECTbranch, owner, repoProtected 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_branch_protectionDELETEbranch, owner, repoProtected 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_branch_protectionEXECbranch, owner, repo, data__enforce_admins, data__required_pull_request_reviews, data__required_status_checks, data__restrictionsProtected 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.

Protecting a branch requires admin or owner permissions to the repository.

Note: Passing new arrays of users and teams replaces their previous values.

Note: The list of users, apps, and teams in total is limited to 100 items.