Skip to content

Create group approval rules post endpoint

Gavin Hinfey requested to merge 428051-create-group-approval-rules-via-api into master

What does this MR do and why?

Add a Post endpoint for Group Approval Rules

Also overrides the protected_branches method in the ApprovalGroupRule model. This returns the protected_branches covered by the applies_to_all_protected_branches flag. Thats all protected branches for each project belonging to the group and protected branches belonging to the group.

Accompanying API doc: !138522 (merged)

How to set up and validate locally

  1. Enable the feature flag approval_group_rules.

  2. Following the documentation included in Add api document for group approval rule post e... (!138522 - merged), add a group level approval rule in your GDK: curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "http://127.0.0.1:3000/api/v4/groups/29/approval_rules?name=newname&approvals_required=2".

  3. As there is no UI for group level approval rules yet, check in the rails console that it has been created: ApprovalRules::ApprovalGroupRule.last.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #428051 (closed)

Edited by Gavin Hinfey

Merge request reports