From 69262feff91c60474f6e2c3f8142288d480c2052 Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Fri, 17 May 2019 16:18:57 -0700 Subject: [PATCH 1/2] fix: make our logic less silly --- src/github.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/github.ts b/src/github.ts index 586ecde4c..2a57cb3c7 100644 --- a/src/github.ts +++ b/src/github.ts @@ -139,10 +139,7 @@ export class GitHub { }); for (let i = 0, pull; i < pullsResponse.data.length; i++) { pull = pullsResponse.data[i]; - // we look for a PR that has autorelease: pending, and type: process; once - // a release occurs, the autorelease: pending label is removed. - if (pull.labels.map(l => l.name).sort().join(',') === - labels.slice(0).sort().join(',')) { + if (this.hasAllLabels(labels, pull.labels.map(l => l.name))) { // it's expected that a release PR will have a // HEAD matching the format repo:release-v1.0.0. if (!pull.head) continue; @@ -158,6 +155,14 @@ export class GitHub { return undefined; } + private hasAllLabels(labelsA: string[], labelsB: string[]) { + let hasAll = true; + labelsA.forEach((label) => { + if (labelsB.indexOf(label) === -1) hasAll = false; + }) + return hasAll; + } + async findOpenReleasePRs(labels: string[], perPage = 25): Promise { const openReleasePRs: PullsListResponseItem[] = []; From ee9e16ca53011da7d3e0ab62a6ab3d7f310c8005 Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Fri, 17 May 2019 16:24:46 -0700 Subject: [PATCH 2/2] chore: fix linting --- src/github.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/github.ts b/src/github.ts index 2a57cb3c7..8ef18bd3b 100644 --- a/src/github.ts +++ b/src/github.ts @@ -159,7 +159,7 @@ export class GitHub { let hasAll = true; labelsA.forEach((label) => { if (labelsB.indexOf(label) === -1) hasAll = false; - }) + }); return hasAll; }