[WIP] Implement merge_when_build_succeeds as project's setting
This MR implements the functionally requested in #13295 (closed).
The approach is to keep as a project setting the flag always_merge_when_build_succeeds
and an authorized user to do the automatic merge.
When a merge request is created, this flag will be checked in the target project. In case it is active, the merge request will be flagged as merge_when_build_succeed
. By doing this, the new functionality relies in the already implement merge_when_build_succeed
.
Behaviour proposed:
- If a build fails, and the MR gets updated with a new commit,
merge_when_build_succeed
will not be reset. If the last build succeed, the merge will happen. - A user allowed to accept the merge is still able to "Cancel merge when build success".
- If a MR is closed and afterwards reopened,
merge_when_build_succeed
will be reset. No automatic merge will happen.
Preview of the new option in the UI (project settings):
Closes #13295 (closed)