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.
This commit is contained in:
Christopher Allford 2023-10-16 10:36:07 -07:00 committed by GitHub
parent 03897613ac
commit 436e6c0482
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 4 deletions

View File

@ -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'