v2

Swagger 2.02026-08-01331211921.0 KB
Branch restrictions

Update a branch restriction rule

Updates an existing branch restriction rule.

Fields not present in the request body are ignored.

See POST for details.

put/repositories/{workspace}/{repo_slug}/branch-restrictions/{id}

Request body

typestring required
idinteger

The branch restriction status' id.

kind'push' | 'delete' | 'force' | 'restrict_merges' | 'require_tasks_to_be_completed' | 'require_approvals_to_merge' | 'require_review_group_approvals_to_merge' | 'require_default_reviewer_approvals_to_merge' | 'require_no_changes_requested' | 'require_passing_builds_to_merge' | 'require_commits_behind' | 'reset_pullrequest_approvals_on_change' | 'smart_reset_pullrequest_approvals' | 'reset_pullrequest_changes_requested_on_change' | 'require_all_dependencies_merged' | 'enforce_merge_checks' | 'allow_auto_merge_when_builds_pass' | 'require_all_comments_resolved' required

The type of restriction that is being applied.

branch_match_kind'branching_model' | 'glob' required

Indicates how the restriction is matched against a branch. The default is glob.

branch_type'feature' | 'bugfix' | 'release' | 'hotfix' | 'development' | 'production'

Apply the restriction to branches of this type. Active when branch_match_kind is branching_model. The branch type will be calculated using the branching model configured for the repository.

patternstring required

Apply the restriction to branches that match this pattern. Active when branch_match_kind is glob. Will be empty when branch_match_kind is branching_model.

valueinteger

Value with kind-specific semantics:

  • require_approvals_to_merge uses it to require a minimum number of approvals on a PR.

  • require_default_reviewer_approvals_to_merge uses it to require a minimum number of approvals from default reviewers on a PR.

  • require_passing_builds_to_merge uses it to require a minimum number of passing builds.

  • require_commits_behind uses it to require the current branch is up to a maximum number of commits behind it destination.

Response

The updated branch restriction rule

typestring required
idinteger

The branch restriction status' id.

kind'push' | 'delete' | 'force' | 'restrict_merges' | 'require_tasks_to_be_completed' | 'require_approvals_to_merge' | 'require_review_group_approvals_to_merge' | 'require_default_reviewer_approvals_to_merge' | 'require_no_changes_requested' | 'require_passing_builds_to_merge' | 'require_commits_behind' | 'reset_pullrequest_approvals_on_change' | 'smart_reset_pullrequest_approvals' | 'reset_pullrequest_changes_requested_on_change' | 'require_all_dependencies_merged' | 'enforce_merge_checks' | 'allow_auto_merge_when_builds_pass' | 'require_all_comments_resolved' required

The type of restriction that is being applied.

branch_match_kind'branching_model' | 'glob' required

Indicates how the restriction is matched against a branch. The default is glob.

branch_type'feature' | 'bugfix' | 'release' | 'hotfix' | 'development' | 'production'

Apply the restriction to branches of this type. Active when branch_match_kind is branching_model. The branch type will be calculated using the branching model configured for the repository.

patternstring required

Apply the restriction to branches that match this pattern. Active when branch_match_kind is glob. Will be empty when branch_match_kind is branching_model.

valueinteger

Value with kind-specific semantics:

  • require_approvals_to_merge uses it to require a minimum number of approvals on a PR.

  • require_default_reviewer_approvals_to_merge uses it to require a minimum number of approvals from default reviewers on a PR.

  • require_passing_builds_to_merge uses it to require a minimum number of passing builds.

  • require_commits_behind uses it to require the current branch is up to a maximum number of commits behind it destination.