2022-02-18 20:35:24 +00:00
|
|
|
name: Add Triage Label
|
|
|
|
on:
|
|
|
|
issues:
|
|
|
|
types: opened
|
2023-01-02 17:28:11 +00:00
|
|
|
permissions: {}
|
2022-02-18 20:35:24 +00:00
|
|
|
jobs:
|
|
|
|
add_label:
|
2022-04-27 01:28:56 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2023-01-02 17:28:11 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
issues: write
|
2022-02-18 20:35:24 +00:00
|
|
|
steps:
|
2022-04-21 18:46:30 +00:00
|
|
|
- uses: actions/checkout@v3
|
2023-10-16 17:36:07 +00:00
|
|
|
# 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);
|
2022-02-18 20:35:24 +00:00
|
|
|
- uses: actions-ecosystem/action-add-labels@v1
|
2023-10-16 17:36:07 +00:00
|
|
|
if: ${{ steps.latest-issue.outputs.hasLabels == 'false'}}
|
2022-02-18 20:35:24 +00:00
|
|
|
with:
|
|
|
|
labels: 'status: awaiting triage'
|