From b849a59fe4c735f106a4ac79cf4b19113717f9c3 Mon Sep 17 00:00:00 2001 From: Tyrone Meijn Date: Fri, 4 Feb 2022 17:22:48 +0100 Subject: [PATCH] fix(gitlab): close MR instead of deleting it --- internal/scm/gitlab/gitlab.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/scm/gitlab/gitlab.go b/internal/scm/gitlab/gitlab.go index b83c8320..93f39062 100644 --- a/internal/scm/gitlab/gitlab.go +++ b/internal/scm/gitlab/gitlab.go @@ -390,7 +390,10 @@ func (g *Gitlab) MergePullRequest(ctx context.Context, pullReq scm.PullRequest) func (g *Gitlab) ClosePullRequest(ctx context.Context, pullReq scm.PullRequest) error { pr := pullReq.(pullRequest) - _, err := g.glClient.MergeRequests.DeleteMergeRequest(pr.targetPID, pr.iid, gitlab.WithContext(ctx)) + stateEvent := "close" + _, _, err := g.glClient.MergeRequests.UpdateMergeRequest(pr.targetPID, pr.iid, &gitlab.UpdateMergeRequestOptions{ + StateEvent: &stateEvent, + }, gitlab.WithContext(ctx)) if err != nil { return err }