gitlab_mr_merge
Merge an open GitLab merge request, with an optional source-branch SHA pin so the merge is rejected if newer commits moved the branch.
Instructions
Merge a merge request. The merge request must be opened - merging a merged or closed one fails. It fails with 405 while it is not mergeable (conflicts, or a required pipeline still running) and with 409 when the source branch moved since you read it, so read the merge request first and pass its sha to pin the merge.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| iid | Yes | project-scoped internal id - the number in !123 for a merge request or #123 for an issue, not the global id | |
| sha | No | source-branch HEAD as you read it; a mismatch is rejected rather than merging newer commits | |
| project | Yes | project id ('42') or full path ('group/subgroup/app'); a path is URL-encoded for you | |
| merge_commit_message | No | ||
| should_remove_source_branch | No | ||
| merge_when_pipeline_succeeds | No | schedule the merge instead of merging now |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ||
| iid | No | internal id - the number in !123 | |
| sha | No | HEAD of the source branch | |
| state | No | opened / closed / locked / merged | |
| title | No | ||
| author | No | user reference | |
| labels | No | ||
| web_url | No | ||
| assignee | No | user reference | |
| milestone | No | ||
| project_id | No | ||
| description | No | ||
| merge_status | No | 'can_be_merged' / 'cannot_be_merged' / 'unchecked'. A merged merge request on 11.3 still reports can_be_merged, so read state first - merge_status alone is not a green light | |
| changes_count | No | a string on 11.3, not a number | |
| has_conflicts | No | not sent by 11.3; compare merge_status instead | |
| source_branch | No | ||
| target_branch | No | ||
| merge_commit_sha | No | ||
| user_notes_count | No | ||
| work_in_progress | No | 11.3 marks a draft MR this way; the title carries a "WIP: " prefix. Verified present on every one of 100 merge requests on the live instance |