Merge when pipeline succeeds conflicts with swapping branch protection
In case "merge when pipeline succeeds" is set and then branch becomes protected from merge, even after its unprotected from merge it still doesn't allow merging. This is happening every time.
Steps to reproduce
- Have a branch protected from push and allow merge
- Create a merge request from fork to that branch
- Set it to "Merge when pipeline succeeds"
- While the pipeline is running using GitLab api protect the branch from merge
- Wait until pipeline is complete
- Unprotect the branch from merge (leave it protected from push)
- Refresh the merge request
What is the current bug behavior?
Merge request is not allowed to be merged. It gives the following error:
You are not allowed to merge on protected branch in this project. This merge failed to be merged automatically.
The only workaround is to push commits again to that fork.
What is the expected correct behavior?
Merge request should be allowed to be merged on that branch