Skip to content

Commit 35d06bc

Browse files
authored
Update triagelabel.yml
1 parent e1e3325 commit 35d06bc

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

.github/workflows/triagelabel.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
name: Label issues
1+
name: Add Triage Label
2+
23
on:
34
issues:
4-
types:
5-
- reopened
6-
- opened
5+
types: [opened]
6+
77
jobs:
8-
label_issues:
8+
triage:
99
runs-on: ubuntu-latest
10-
permissions:
11-
issues: write
1210
steps:
13-
- run: gh issue edit "$NUMBER" --add-label "triage"
14-
env:
15-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16-
GH_REPO: ${{ github.repository }}
17-
NUMBER: ${{ github.event.issue.number }}
11+
- name: Check for existing labels
12+
id: check_labels
13+
uses: actions/github-script@v6
14+
with:
15+
script: |
16+
const labels = await github.issues.listLabelsOnIssue({
17+
owner: context.repo.owner,
18+
repo: context.repo.repo,
19+
issue_number: context.issue.number
20+
});
21+
return labels.data.length > 0;
22+
23+
- name: Add Triage Label
24+
if: steps.check_labels.outputs.result == 'false'
25+
uses: actions-ecosystem/action-add-labels@v1
26+
with:
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
labels: triage

0 commit comments

Comments
 (0)