Skip to content

Commit 541b146

Browse files
yangdanny97meta-codesync[bot]
authored andcommitted
remove existing labels when size labeler runs
Summary: that way if the PR size changes we do not add a second label Reviewed By: rchen152 Differential Revision: D98347139 fbshipit-source-id: a7d9c8c83e3e322653a6c8a0dea3160fe633b642
1 parent 0a4448d commit 541b146

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/size_labeler.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@ jobs:
1313
runs-on: ubuntu-latest
1414
name: Label the PR size
1515
steps:
16+
- name: Remove existing size labels
17+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
18+
continue-on-error: true
19+
with:
20+
script: |
21+
const sizeLabels = ['size/xs', 'size/s', 'size/m', 'size/l', 'size/xl'];
22+
for (const label of sizeLabels) {
23+
try {
24+
await github.rest.issues.removeLabel({
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
issue_number: context.payload.pull_request.number,
28+
name: label,
29+
});
30+
} catch (e) {
31+
// Label may not exist on the PR; ignore errors
32+
}
33+
}
1634
- uses: codelytv/pr-size-labeler@4ec67706cd878fbc1c8db0a5dcd28b6bb412e85a # v1
1735
with:
1836
xs_label: 'size/xs'

0 commit comments

Comments
 (0)