feat: add GraphQL support for project targetBranchRules
Summary
- Add
TargetBranchRulesServicewith a typed GraphQL wrapper for thetargetBranchRulesfield on theProjecttype - Implement
ListProjectTargetBranchRules,CreateTargetBranchRule,UpdateTargetBranchRule, andDeleteTargetBranchRulemethods - Register the service on the
Clientstruct and regenerate mocks
Closes #2247 (closed)
Motivation
Needed by glab to fix gitlab-org/cli#8232, where glab mr create ignores the repository's configured branch workflow rules. Without this typed wrapper, glab would need to hand-roll raw GraphQL queries via client.GraphQL.Do().
Test plan
-
TestTargetBranchRules_ListProjectTargetBranchRules— happy path and project-not-found -
TestTargetBranchRules_CreateTargetBranchRule— happy path and mutation errors -
TestTargetBranchRules_UpdateTargetBranchRule— happy path and mutation errors -
TestTargetBranchRules_DeleteTargetBranchRule— happy path and mutation errors -
go build ./...passes -
make generateproduces correct mock and client stubs