Make `any_merge_request` rules respect `branch_exceptions`

What does this MR do and why?

MR approval policies any_merge_request rules currently don't respect branch_exceptions.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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.

How to set up and validate locally

  1. Create a new group top-level and a contained project, top-level/test-project
  2. On the project-level, navigate to Code > Branches and create two branches, develop and rc
  3. Navigate to Settings > Repository, expand Protected branches and protect both branches
  4. Open MRs targeting both branches
  5. On the group-level, navigate to Secure > Policies and create the following:
type: approval_policy
name: Test policy
enabled: true
actions:
- type: require_approval
  approvals_required: 1
  role_approvers:
  - developer
  - maintainer
  - owner
rules:
- type: any_merge_request
  branch_type: protected
  commits: any
  branch_exceptions:
  - name: develop
    full_path: top-level/test-project
  - rc
  1. Verify that none of the MRs require approval

Related to #2293 (closed)

Edited by Dominic Bauer

Merge request reports

Loading