From 23b6bd1101ff4fabe418aaf4246ddff2ac6015a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 8 Oct 2020 15:05:53 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=EF=B8=8F=20Update=20label?= =?UTF-8?q?er=20workflow=20with=20new=20labels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue_labeler.yml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/issue_labeler.yml b/.github/workflows/issue_labeler.yml index a8842872f..0960f6580 100644 --- a/.github/workflows/issue_labeler.yml +++ b/.github/workflows/issue_labeler.yml @@ -11,23 +11,29 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - let labels = []; + let labels = []: + context.issue.labels.forEach(label => { labels.push(label.name) }); if (context.payload.issue.title.match(/\[request\]|feature request/i)) { - labels.push('type:request'); + labels.push('request'); + labels = labels.filter(label => label !== 'triage'); } if (context.payload.issue.title.match(/\[brainstorming\]/i)) { - labels.push('type:brainstorming'); + labels.push('brainstorming'); + labels = labels.filter(label => label !== 'triage'); } if (context.payload.issue.title.match(/\[rc feedback\]/i)) { - labels.push('type:rc feedback'); + labels.push('rc feedback'); + labels = labels.filter(label => label !== 'triage'); } - if (labels.length > 0) { - github.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: labels - }) + if (labels.length === 0) { + labels.push('triage'); } + + github.issues.setLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: labels + })