Clarify error message when approval policy targets unprotected default branch
requested to merge 444676-disable-default-branch-for-mr-policy-if-default-branch-is-unprotected into master
What does this MR do and why?
MR approval policy can only affect protected branches. The current error message we present to users when a policy rules targets an unprotected default branch is not clear however. This MR improves the error message for this case.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
How to set up and validate locally
- create a new project
- navigate to
Settings > Repository
and underProtected branches
, unprotectmain
- navigate to
Secure > Policies
and attempt to create the following Merge request approval policy:
type: approval_policy
name: Test
enabled: true
rules:
- type: any_merge_request
branch_type: default
actions:
- type: require_approval
approvals_required: 1
role_approvers: [owner]
- verify that you're presented with the error message
At least one policy rule requires this project's default branch to be protected.
Related to #481447 (closed)
Edited by Dominic Bauer