File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -32,11 +32,26 @@ jobs:
32
32
['* Documentation', 'documentation'],
33
33
['* Not for changelog', 'not-for-changelog']
34
34
];
35
- if (!description) return;
35
+ // remove all labels owned by current script
36
+ for (let pair of mapping) {
37
+ try {
38
+ const result = await github.rest.issues.removeLabel({
39
+ owner,
40
+ repo,
41
+ issue_number: prNumber,
42
+ name: pair[1]
43
+ });
44
+ console.log('Removed label', pair[1]);
45
+ } catch(e) {
46
+ console.log(e);
47
+ }
48
+ }
49
+ // add first encountered label
36
50
for (let pair of mapping) {
37
51
if (!description.includes(pair[0])) continue;
52
+ // add label
38
53
try {
39
- const result = await github.rest.issues.addLabels({
54
+ const result = await github.rest.issues.addLabels({
40
55
owner,
41
56
repo,
42
57
issue_number: prNumber,
46
61
} catch(e) {
47
62
console.log(e);
48
63
}
49
- return ;
64
+ break ;
50
65
}
You can’t perform that action at this time.
0 commit comments