Skip to content

Add default_branch_protection_defaults in groups apis

What does this MR do and why?

Add default_branch_protection_defaults in groups apis

This commit adds default_branch_protection_defaults field in group create and update api

Changelog: added

How to set up and validate locally

  1. Run below curl to test group creation along with default branch protection defaults passed
curl --location --request POST 'http://127.0.0.1:3000//api/v4/groups/' \
--header 'Authorization: Bearer "YOUR_TOKEN_HERE"' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "new_group", 
    "path": "new_group",
"default_branch_protection_defaults": {
        "allowed_to_push": [
            {
                "access_level": 30
            }
        ],
        "allowed_to_merge": [
            {
                "access_level": 40
            }
        ]
    }
}'
  1. And to test updates run below curl
curl --location --request PUT 'http://127.0.0.1:3000//api/v4/groups/119/' \
--header 'Authorization: Bearer "YOUR_TOKEN_HERE"' \
--header 'Content-Type: application/json' \
--data-raw '{
"default_branch_protection_defaults": {
        "allowed_to_push": [
            {
                "access_level": 40
            }
        ],
        "allow_force_push": false,
        "allowed_to_merge": [
            {
                "access_level": 40
            }
        ]
    }
}'

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 #408151 (closed)

Edited by Harsimar Sandhu

Merge request reports