Fix /merge quick action by submitting head SHA with the new note
Summary
The /merge
quick action in any MR comment causes the API to fail. Original issue: #352 (closed)
Steps to reproduce
Try to send a comment on an open MR that contains the /merge
quick action.
What is the current bug behavior?
GitLab API fails with 500 error.
What is the expected correct behavior?
The MR gets merged.
Relevant logs and/or screenshots
Possible fixes
We need to submit the CreateNoteInput.mergeRequestDiffHeadSha
parameter to the GraphQL createNote
mutation. This parameter should contain the MR HEAD SHA and it is used for optimistic locking.
Maybe we'll need to add a condition and only submit the parameter if the GitLab version is 14.9 or higher. I'm not 100% sure how GraphQL handles input parameters that are not defined (because the mergeRequestDiffHeadSha
parameter won't be defined on older versions)
Edited by Tomas Vik (OOO back on 2024-09-23)