From 8e95441bbc18a86ba17ed5f2518497f491fe7c30 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Sat, 28 Dec 2024 20:01:01 -0500 Subject: [PATCH 1/2] Fix triagelabel workflow --- .github/workflows/triagelabel.yml | 32 +++++++++++++------------------ 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/triagelabel.yml b/.github/workflows/triagelabel.yml index 74127b0cc..bea3e5cda 100644 --- a/.github/workflows/triagelabel.yml +++ b/.github/workflows/triagelabel.yml @@ -2,27 +2,21 @@ name: Add Triage Label on: issues: - types: [opened] + types: + - reopened + - opened jobs: triage: runs-on: ubuntu-latest + permissions: + issues: write steps: - - name: Check for existing labels - id: check_labels - uses: actions/github-script@v6 - with: - script: | - const labels = await github.issues.listLabelsOnIssue({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number - }); - return labels.data.length > 0; - - - name: Add Triage Label - if: steps.check_labels.outputs.result == 'false' - uses: actions-ecosystem/action-add-labels@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - labels: triage + - name: Add or check for existing labels + # add the triage label only if no label has been added + if: ${{ github.event.issue.labels[0] != null }} + run: gh issue edit "$NUMBER" --add-label "triage" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} From 0c5061c19cc2efd7ca026df22733ffa9003a4eff Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Sat, 28 Dec 2024 20:06:40 -0500 Subject: [PATCH 2/2] flip the check logic --- .github/workflows/triagelabel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/triagelabel.yml b/.github/workflows/triagelabel.yml index bea3e5cda..e22f491ca 100644 --- a/.github/workflows/triagelabel.yml +++ b/.github/workflows/triagelabel.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Add or check for existing labels # add the triage label only if no label has been added - if: ${{ github.event.issue.labels[0] != null }} + if: ${{ github.event.issue.labels[0] == null }} run: gh issue edit "$NUMBER" --add-label "triage" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}