From 08aae8cffba7151340bd6c0cd7331722b9f9a80a Mon Sep 17 00:00:00 2001 From: Pascal Grimaud Date: Sun, 4 Oct 2020 18:28:57 +0200 Subject: [PATCH] feat: GitHub Actions Improve triage (#12641) This improves the GitHub triage action to check if labels already exist. --- .github/workflows/triage.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index c0fd5d11497b..b21dff26fada 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -29,4 +29,22 @@ jobs: github-token: ${{secrets.GITHUB_TOKEN}} script: | const issue = { owner: context.issue.owner, repo: context.issue.repo, issue_number: context.issue.number } - github.issues.addLabels({...issue, labels: ['area: triage', 'theme: undefined']}) + github.issues.listLabelsOnIssue({...issue}).then(response => { + const labels = response.data + let missingLabel = [], missingArea = true, missingTheme = true + for (const label of labels) { + if (label.name.includes('area: ')) { + missingArea = false + } + if (label.name.includes('theme: ')) { + missingTheme = false + } + } + if (missingArea) { + missingLabel.push('area: triage') + } + if (missingTheme) { + missingLabel.push('theme: undefined') + } + github.issues.addLabels({...issue, labels: missingLabel}) + })