Skip to main content

branch_protection

Overview

Namebranch_protection
TypeResource
Idgithub.repos.branch_protection

Fields

NameDatatypeDescription
namestring
allow_deletionsobject
allow_force_pushesobject
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.
block_creationsobject
enabledboolean
enforce_adminsobjectProtected Branch Admin Enforced
lock_branchobjectWhether to set the branch as read-only. If this is true, users will not be able to push to the branch.
protection_urlstring
required_conversation_resolutionobject
required_linear_historyobject
required_pull_request_reviewsobjectProtected Branch Pull Request Review
required_signaturesobject
required_status_checksobjectProtected Branch Required Status Check
restrictionsobjectBranch Restriction Policy
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.