-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (35 loc) · 1.13 KB
/
remove-labels.yml
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
36
37
38
39
40
name: 'Remove labels'
on:
issue_comment:
types: [created]
jobs:
remove_label:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/github-script@v7
with:
script: |
const issue_num = context.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const commentAuthor = context.payload.comment.user.login;
const issue = await github.rest.issues.get({
owner,
repo,
issue_number: issue_num
});
if (commentAuthor === issue.data.user.login) {
const labelsToRemove = ['needs more information', 'stale', 'Stale'];
for (const label of labelsToRemove) {
if (issue.data.labels.some(issueLabel => issueLabel.name === label)) {
await github.rest.issues.removeLabel({
issue_number: issue_num,
owner,
repo,
name: label
});
}
}
}