Calling 'accept MR' API may fail because merge_status is set to a value that requires mergeability to be checked
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
A workflow that involves automatically raising and merging (accepting) MRs via the API may encounter the issue that the MR is in a state that is interpreted as cannot_be_merged.
Some of these (back end) states include unchecked, cannot_be_merged_recheck, cannot_be_merged_rechecking and probably checking.
Calling get a single mr may trigger an update of this property if applicable, and it may then transition to can_be_merged. This is an async check, as noted in the API docs, so it may required two or more (depending on the sleep period) polls of 'get a single mr' to trigger the check, and for the check to complete and a value be returned.
Otherwise, calling accept MR may fail (405 - with no specific explanation (issue)). When checked in the UI, one imagines the state of the MR is refreshed, so there's then confusion about why a mergeable MR could not be accepted.
Ticket: 177710
Agent: Ben Prescott