-
Notifications
You must be signed in to change notification settings - Fork 1
35 lines (31 loc) · 1.13 KB
/
Copy pathtriage.yml
File metadata and controls
35 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Workflow adapted from https://github.com/actions/github-script#apply-a-label-to-an-issue
name: Triage Issues and PRs
on:
issues:
types: [opened]
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
// Check if the issue already has labels
const { data: labels } = await github.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
console.debug(`Issue ${context.issue.number}'s labels:`, labels);
if (labels.length == 0) {
console.log(`Issue ${context.issue.number} has no labels - adding the triage label...`);
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['status: needs-triage']
})
} else {
console.log(`Issue ${context.issue.number} already has a label - skipping...`);
}