Altering number of approvals required for MR rule changes rule target

Summary

When a merge request approval rule is created with a Target branch of "All protected branches" changing the number of Approvals required after the rule is created will result in the Target branch for the rule automatically changing from "All protected branches" to "All branches."

Steps to reproduce

  1. Navigate to Settings > Merge Request > Merge request approvals in any project
  2. Create a new merge request approval rule with a Target branch of "All protected branches" and save the rule.
  3. Once the rule has been created change the number of Approvals required via the increment arrows on the number box (not by editing the rule and saving changes)
  4. The Target branch will change to "All branches" automatically within seconds of changing the number of approvals.

Example Project

https://gitlab.com/rcastro6/rcastro-issue-list/

What is the current bug behavior?

The Target branch setting of the rule changes automatically after adjusting the number of approvals.

What is the expected correct behavior?

The Target branch setting should not change without being initiated by a user.

Relevant logs and/or screenshots

New rule targeting All Protected branches.

approval1

Rule is created.

approval2

Change the number of approvals required via the increment arrows on the number of approvals box.

approval3

Target branch changes automatically

approval4

Output of checks

This bug happens on GitLab.com

Reproduced on 17.5.4 and 17.6.1 as well.

Edited by Ryan Castro