fix(mr): don't report "Merged!" when auto-merge is only armed

What does this MR do?

glab mr merge --auto-merge previously printed ✓ Merged! even when the merge request remained open and was only armed for auto-merge (for example, while awaiting an approval or unresolved discussion).

Fix

  • Determine whether the request merged from the API response (mr.State == "merged").
  • For an armed-but-open merge request, print ✓ Auto-merge enabled, matching the GitLab UI.
  • Preserve ✓ Merged! for an immediate successful merge.

Testing

  • Resolved the conflict with upstream main; GitLab reports has_conflicts: false.
  • Rebuilt with make build; the binary reports glab 1.106.0 (7a87cec7).
  • Used that rebuilt binary to query this merge request successfully with ./bin/glab mr view 3475 -R gitlab-org/cli --output json.
  • Temporary fork test MR: zotavka/cli!3 (closed) (closed during cleanup). The fork could not provide a runnable pipeline gate, so it did not serve as a live auto-merge demonstration.

Regression output

The focused command test asserts this exact output for an armed-but-open MR:

✓ Pipeline succeeded.
✓ Auto-merge enabled
https://gitlab.com/OWNER/REPO/-/merge_requests/123
=== RUN   TestMrMerge/Auto-merge_armed_on_successful_pipeline_does_not_report_merged
--- PASS: TestMrMerge (0.00s)
    --- PASS: TestMrMerge/Auto-merge_armed_on_successful_pipeline_does_not_report_merged (0.00s)
PASS
  • CI is expected not to run in this fork because of upstream-runner permissions.

Closes #8485 (closed)

Edited by Kai Armstrong

Merge request reports

Loading
Loading