Merge Request failed to merge automatically when created by git push option
When a Merge Request was created with git push -o merge_request.create -o merge_request.merge_when_pipeline_succeeds
, it will be marked to be merge automatically pending pipeline result.
However the changed files could require approval (i.e. CODEOWNERS approval) so it will lead to a situation where approval comes AFTER the pipeline has succeed. This leads to the MR failing to merge automatically and instead, stuck until user use the WebUI for a manual merge.
Reproduce
git checkout -b my-mr-branch
echo a > a
git add a
git commit -m 'Added file a'
git push --set-upstream origin my-my-branch -o merge_request.create -o merge_request.merge_when_pipeline_succeeds
# MR created
# Pipeline succeed
# Approver click 'Approve' on Web UI
Expectation
MR should be merged after all required checks (Approval + Pipeline) are satisfied.
Actual
MR stuck until user click 'Cancel automatic merge' and then clicking 'Merge' manually on WebUI