Resolve "Setting auto-merge using the API fails when the option is available in the UI"
What does this MR do and why?
We weren't handling the new merge when checks pass correctly in the api. Previously we were only checking the pipeline information, rather we should check if the strategy is available or not
Steps to test
-
Create a project and activate the
Pipelines must succeedoption under Project settings -> Merge requests -
Create a branch with the following .gitlab-ci.yml file
Job 1: script: exit 1 -
Create a MR
-
Observe the MR has the auto-merge button available.
-
Try setting the MR to auto-merge using the API
curl --request PUT -H "PRIVATE-TOKEN: <token>" "https://gitlab.com/api/v4/projects/:id/merge_requests/:iid/merge?merge_when_pipeline_succeeds=true" {"message":"405 Method Not Allowed" -
Refresh the page and see that the auto merge was successfully set
Related to #488615 (closed)
Edited by Marc Shaw