From 4668433d9cef8f792ce4df1417d1682d72464ce6 Mon Sep 17 00:00:00 2001 From: Nicolas Pierre Date: Fri, 10 Jun 2022 17:56:33 +0200 Subject: [PATCH] fix: select only opened mr (#1038) (#1040) --- src/drivers/gitlab.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/drivers/gitlab.js b/src/drivers/gitlab.js index a0beb531f..3d522f3a3 100644 --- a/src/drivers/gitlab.js +++ b/src/drivers/gitlab.js @@ -103,14 +103,20 @@ class Gitlab { const endpoint = `/projects/${projectPath}/repository/commits/${commitSha}/merge_requests`; const prs = await this.request({ endpoint, method: 'GET' }); - return prs.map((pr) => { - const { web_url: url, source_branch: source, target_branch: target } = pr; - return { - url, - source, - target - }; - }); + return prs + .filter((pr) => pr.state === 'opened') + .map((pr) => { + const { + web_url: url, + source_branch: source, + target_branch: target + } = pr; + return { + url, + source, + target + }; + }); } async checkCreate() {