-
Notifications
You must be signed in to change notification settings - Fork 28
55 lines (50 loc) · 1.68 KB
/
Copy pathissue-assigned.yml
File metadata and controls
55 lines (50 loc) · 1.68 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
##############################################################################
##############################################################################
#
# NOTE!
#
# Please read the README.md file in this directory that defines what should
# be placed in this file
#
##############################################################################
##############################################################################
name: Issue Assignment Workflow
on:
issues:
types: ['assigned']
permissions:
contents: read
issues: write
jobs:
Remove-Unapproved-Label:
name: Remove Unapproved Label when issue is assigned
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
const apiParams = {
owner,
repo,
issue_number
};
// Get current labels on the issue
const { data: labelList } = await github.rest.issues.listLabelsOnIssue(apiParams);
const unapprovedLabel = labelList.find(l =>
l.name.toLowerCase().includes('unapprov') // matches 'unapproved' too
);
// Remove unapproved label if it exists
if (unapprovedLabel) {
try {
await github.rest.issues.removeLabel({
owner,
repo,
issue_number,
name: unapprovedLabel.name,
});
} catch (err) {
if (err.status !== 404) throw err;
}
}