From e04dbc38b6261a0d95681433cc64a46d4444431c Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Thu, 8 Nov 2018 23:41:52 +0100 Subject: [PATCH] fix(gitlab): check MR branch status only if opened Fixes #2771 --- lib/platform/gitlab/index.js | 2 +- test/platform/gitlab/__snapshots__/index.spec.js.snap | 2 +- test/platform/gitlab/index.spec.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/platform/gitlab/index.js b/lib/platform/gitlab/index.js index b7eaacac48..337b19d1a2 100644 --- a/lib/platform/gitlab/index.js +++ b/lib/platform/gitlab/index.js @@ -686,7 +686,7 @@ async function getPr(iid) { logger.debug('pr cannot be merged'); pr.canMerge = false; pr.isConflicted = true; - } else { + } else if (pr.state === 'open') { const branchStatus = await getBranchStatus(pr.branchName, []); if (branchStatus === 'success') { pr.canMerge = true; diff --git a/test/platform/gitlab/__snapshots__/index.spec.js.snap b/test/platform/gitlab/__snapshots__/index.spec.js.snap index 132dc8dae0..971da13226 100644 --- a/test/platform/gitlab/__snapshots__/index.spec.js.snap +++ b/test/platform/gitlab/__snapshots__/index.spec.js.snap @@ -194,7 +194,7 @@ Object { "isStale": false, "number": 91, "source_branch": "some-branch", - "state": undefined, + "state": "open", } `; diff --git a/test/platform/gitlab/index.spec.js b/test/platform/gitlab/index.spec.js index ae9dcbb1b9..30b1e6ba73 100644 --- a/test/platform/gitlab/index.spec.js +++ b/test/platform/gitlab/index.spec.js @@ -327,6 +327,7 @@ describe('platform/gitlab', () => { get.mockReturnValueOnce({ body: { iid: 91, + state: 'opened', additions: 1, deletions: 1, commits: 1, -- GitLab