-
Notifications
You must be signed in to change notification settings - Fork 642
39 lines (34 loc) · 1.16 KB
/
rm-labels-on-closed.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
name: "Remove 'Unsorted' labels when the issue is closed"
on:
issues:
types: [closed]
jobs:
remove_label:
if: ${{ github.repository == 'AdguardTeam/AdguardFilters' }}
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const issueNumber = context.issue.number;
const issueLabelsRaw = await github.rest.issues.listLabelsOnIssue({
owner,
repo,
issue_number: issueNumber,
});
const issueLabels = issueLabelsRaw.data.map((el) => el.name);
const labelsToRemove = [ 'Unsorted' ];
for (let label of labelsToRemove) {
if (issueLabels.includes(label)) {
console.log(`Removing ${label} from #${issueNumber}`);
await github.rest.issues.removeLabel({
owner,
repo,
issue_number: issueNumber,
name: label,
});
}
}