Accept branchProtection args via branchRuleUpdate mutation
What does this MR do and why?
Accept branchProtection args via branchRuleUpdate mutation
Now we accept branchProtection arguments in the branchRuleUpdate mutation.
In CE these include:
branchRuleUpdate { branchProtection { allowForcePush: Boolean mergeAccessLevels [ access_level: Integer ] pushAccessLevels [ accessLevel: Integer deployKeyId: GlobalID ] } }
In EE we additionally allow:
branchRuleUpdate { branchProtection { codeOwnerApprovalRequired: Boolean mergeAccessLevels: [ { userId: GlobalID groupId: GlobalID } ] pushAccessLevels: [ { userId: GlobalID groupId: GlobalID } ] } }
Closes #441471 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
You will need to find valid IDs from your GDK for this to work.
mutation {
branchRuleUpdate(
input: {
id: "gid://gitlab/Projects::BranchRule/129",
name: "master",
branchProtection: {
allowForcePush: true,
codeOwnerApprovalRequired: true,
mergeAccessLevels: [
{ accessLevel: 30 },
{ userId: "gid://gitlab/User/1" },
{ groupId: "gid://gitlab/Group/1" },
],
pushAccessLevels: [
{ accessLevel: 30 },
{ userId: "gid://gitlab/User/1" },
{ groupId: "gid://gitlab/Group/1" },
{ deployKeyId: "gid://gitlab/DeployKey/1" }
]
}
}
) {
branchRule {
id
name
branchProtection {
mergeAccessLevels {
nodes {
accessLevel
accessLevelDescription
user {
id
}
group {
id
}
}
}
pushAccessLevels {
nodes {
accessLevel
accessLevelDescription
user {
id
}
group {
id
}
deployKey {
id
}
}
}
codeOwnerApprovalRequired
allowForcePush
}
}
errors
}
}