Skip to content

Add mutations to update squash options

What does this MR do and why?

Support updating squash options for branch rules:

  • Add mutation for updating/creating and deleting squash options for branch rules
  • Validate name changes on protected branches with squash options

Example update request

mutation ($input: BranchRuleSquashOptionUpdateInput!) {
  branchRuleSquashOptionUpdate(input: $input) {
    errors   
    squashOption {
      option
      helpText
    }
  }
}
{
  "input": {
    "branchRuleId":"gid://gitlab/Projects::BranchRule/293",
    "squashOption": "NEVER"
  }
}

Example delete request

mutation ($input: BranchRuleSquashOptionDeleteInput!) {
  branchRuleSquashOptionDelete(input: $input){
    errors
  }
}
{
  "input": {
    "branchRuleId": "gid://gitlab/Projects::BranchRule/318"
  }
}

References

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.

How to set up and validate locally

  1. Simulate Saas (https://docs.gitlab.com/ee/development/ee_features.html#simulate-a-saas-instance)
  2. Enable the branch_rule_squash_settings feature flag
  3. Create a group and add a premium plan to the group
  4. Create a project in the group and add a protected branch
  5. Try the update mutation to create/update a squash option
  6. Try updating the protected branch to use a wildcard
  7. Try the delete mutation to delete the squash option

Related to #498700 (closed)

Edited by Joe Woodward

Merge request reports

Loading