From 436e6c0482c3bf3b0212f2e1c2422bd1738e74d6 Mon Sep 17 00:00:00 2001 From: Christopher Allford <6451942+ObliviousHarmony@users.noreply.github.com> Date: Mon, 16 Oct 2023 10:36:07 -0700 Subject: [PATCH] Add Triage Label Delay (#40783) This makes sure that authors have an opportunity to add a label before the triage label gets added due to a lack of labels. --- .github/workflows/triage-label.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/triage-label.yml b/.github/workflows/triage-label.yml index b7f6485a31d..0b7251abd83 100644 --- a/.github/workflows/triage-label.yml +++ b/.github/workflows/triage-label.yml @@ -1,11 +1,8 @@ name: Add Triage Label - on: issues: types: opened - permissions: {} - jobs: add_label: runs-on: ubuntu-20.04 @@ -14,7 +11,22 @@ jobs: issues: write steps: - uses: actions/checkout@v3 + # We want to delay the labeling of the issue so that the author has a change to add labels after issue creation. + - name: 'Delay Labeling' + run: sleep 3m + # Make sure that the latest issue is pulled from the database rather than relying on the payload. This is + # because the payload won't include any labels that were added after the issue was created. + - uses: actions/github-script@v6 + id: latest-issue + with: + script: | + const issue = await github.rest.issues.get({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number + }); + core.setOutput('hasLabels', issue.data.labels.length > 0); - uses: actions-ecosystem/action-add-labels@v1 - if: github.event.issue.labels[0] == null + if: ${{ steps.latest-issue.outputs.hasLabels == 'false'}} with: labels: 'status: awaiting triage'