Skip to content

Commit ee52675

Browse files
authored
feat: remove existing size labels before adding new (#74)
1 parent 5e07f35 commit ee52675

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/pr-size-labeler.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,29 @@ jobs:
1818
with:
1919
fetch-depth: 0
2020

21+
- name: Remove existing size labels
22+
uses: actions/github-script@v7
23+
with:
24+
script: |
25+
const sizeLabels = ['size/XS', 'size/S', 'size/M', 'size/L', 'size/XL'];
26+
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
issue_number: context.issue.number,
30+
});
31+
32+
for (const label of labels) {
33+
if (sizeLabels.includes(label.name)) {
34+
console.log(`Removing existing size label: ${label.name}`);
35+
await github.rest.issues.removeLabel({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
issue_number: context.issue.number,
39+
name: label.name,
40+
});
41+
}
42+
}
43+
2144
- name: Label PR based on size
2245
uses: codelytv/pr-size-labeler@v1
2346
with:

0 commit comments

Comments
 (0)