Create branch policy

createBranchPolicy(input: CreateBranchPolicyInput!): BranchPolicy!

Requires project.settings.manage.

Arguments

ArgumentTypeRequired
inputCreateBranchPolicyInput!Yes

Input fields

input

CreateBranchPolicyInput

FieldTypeRequiredDescription
projectReferenceStringNo
nameString!Yes
isEnabledBooleanNoEnable this policy. Null and omission use the true default.
targetBranchPatternStringNo
requiredApprovalsIntNoRequired approval count. Null and omission default to 0; MCP create_branch_policy defaults to 1.
allowSelfApprovalBooleanNoAllow the merger’s approval to count. Null and omission default to true; MCP create_branch_policy defaults to false.
requiredReviewerIds[String!]NoReviewer UUIDs required for merge. Null and omission impose no specific reviewers; an empty list is accepted.

Response

Returns BranchPolicy!. Open the type for its fields and nested types.

FieldTypeDescription
idID!
projectIdID!
nameString!
isEnabledBoolean!
targetBranchPatternString
requiredApprovalsInt!
allowSelfApprovalBoolean!
requiredReviewerIds[String!]Reviewer UUIDs required for merge. Null and omission impose no specific reviewers; an empty list is accepted.

All fields of BranchPolicy.

Types marked with ! cannot be null. Lists use [Type] notation. The type index lists all published input and response types.

Example

graphql
mutation CreateBranchPolicy($input: CreateBranchPolicyInput!) {
  createBranchPolicy(input: $input) {
    id
    projectId
    name
    createdAt
    updatedAt
  }
}
json
{
  "input": {
    "projectReference": "00000000-0000-4000-8000-000000000001",
    "name": "example"
  }
}