Add mutation to edit approval rules
What does this MR do and why?
Add mutation to edit approval rules
Requires:
- id which is a GlobalID
- name
- approvals_required
- user_ids
- group_ids
Returns:
- approval_rule which is an instance of ApprovalProjectRule
Closes #441289 (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
In the graphql explorer:
Replace id with an approval project rule ID for your GDK using the following
query {
project(fullPath: "Flightjs/flight") {
branchRules {
nodes {
approvalRules {
nodes {
id
}
}
}
}
}
}
If you can't find one with the previous snippet you can generate your own by following this format
gid://gitlab/ApprovalProjectRule/#{approval_project_rule_id}
You may also want to replace the user and group ids. User 1 should be the root user which is admin so I believe they would have access to the project already but you may want to invite them.
Group 1 may also need to be invited to the project or alternatively create a new group and invite them to the project. Invite members to that group and they should be added to the approval rule.
mutation {
approvalProjectRuleUpdate(input:{ id: "gid://gitlab/ApprovalProjectRule/4", name: "New Name", approvalsRequired: 4, userIds: [1], groupIds: [1]}) {
approvalRule {
id
name
type
approvalsRequired
eligibleApprovers {
nodes {
id
username
email
}
}
}
}
}