Add ProjectPushRulesUpdate GraphQL mutation

What does this MR do and why?

Contributes to #509936

Problem

There was no GraphQL mutation to update push rules for a project. Users had to use the REST API to modify push rules configuration.

Solution

Add ProjectPushRulesUpdate mutation that allows updating all push rule fields via GraphQL. The mutation uses the existing PushRules::CreateOrUpdateService for upsert logic and supports all fields including feature-gated ones (commit_committer_check, reject_unsigned_commits, etc.).

References

Screenshots or screen recordings

N/A - No UI changes

How to set up and validate locally

  1. Start a Rails console or GraphiQL
  2. Run the mutation on a project where you have maintainer access:
    mutation {
      projectPushRulesUpdate(input: {
        fullPath: "your/project"
        denyDeleteTag: true
        preventSecrets: true
        commitMessageRegex: "^(feat|fix|docs):"
        maxFileSize: 100
      }) {
        pushRules {
          denyDeleteTag
          preventSecrets
          commitMessageRegex
          maxFileSize
        }
        errors
      }
    }
  3. Verify the push rules are updated and returned correctly

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports

Loading