feat: add GraphQL support for project targetBranchRules

Summary

  • Add TargetBranchRulesService with a typed GraphQL wrapper for the targetBranchRules field on the Project type
  • Implement ListProjectTargetBranchRules, CreateTargetBranchRule, UpdateTargetBranchRule, and DeleteTargetBranchRule methods
  • Register the service on the Client struct 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 generate produces correct mock and client stubs

🤖 Generated with Claude Code

Merge request reports

Loading