gitlab4j-api icon indicating copy to clipboard operation
gitlab4j-api copied to clipboard

is it possible to have auto merge option when creating an MR ?

Open juliocbcotta opened this issue 2 years ago • 1 comments

I would like to be able to create an MR with the option "auto merge", but I couldn't find anything in the API. Would it be possible to add it to the API?

juliocbcotta avatar Oct 17 '23 08:10 juliocbcotta

I think this can be done. You need to create a AcceptMergeRequestParams and set withMergeWhenPipelineSucceeds(true) and then on the MergeRequestApi instance, call acceptMergeRequest(project, mr, param)

A real world example: https://github.com/unblu/ucascade/blob/7e8f23adf3246c2f0ce510d81903b3aeea78797f/src/main/java/service/GitLabService.java#L372,383 (with all sort of tricks like retries and pause to make it work in reality)

jmini avatar Oct 20 '23 08:10 jmini