Add `buildMissing` argument to grapqhl field `project.branchRules`
What does this MR do and why?
Add buildMissing argument to projects.branchRules field
The branchRules field on project now accepts an argument to return missing custom branch rules. Custom branch rules are only available in EE and currently include All branches
and All protected branches
rules.
buildMissing
accepts a Boolean value and defaults to false
when null
In #388129 (closed) we need to be able to "create" a rule to be able to edit it. As these rules present real records but are not persisted in the db, when you "create" the rule without any approvalRules or externalStatusChecks we don't actually save anything.
To get around this, we have added a new argument to return these branch rules even if they are not persisted yet.
Closes #455420 (closed)
Testing
You can use the graphql explorer http://gdk.test:3000/-/graphql-explorer
{
project(fullPath: "Flightjs/flight") {
branchRules(buildMissing: true) {
nodes {
id
name
approvalRules {
nodes {
id
}
}
externalStatusChecks {
nodes {
id
name
}
}
branchProtection {
mergeAccessLevels {
nodes {
accessLevel
accessLevelDescription
user {
id
}
group {
id
}
}
}
pushAccessLevels {
nodes {
accessLevel
accessLevelDescription
user {
id
}
group {
id
}
deployKey {
id
}
}
}
codeOwnerApprovalRequired
allowForcePush
}
}
}
}
}