Skip to content

Commit

Permalink
fix workflow to remove size labels
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixTJDietrich committed Aug 11, 2024
1 parent 781a6c7 commit 2c92bd6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,32 @@ jobs:
else if (changedLines > 9) label = 'size:S';
else label = 'size:XS';
console.log("Fetching existing labels...");
const labels = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const sizeLabels = labels.data
.filter(label => label.name.startsWith('size:'))
.map(label => label.name);
if (sizeLabels.length > 0) {
console.log(`Removing existing size labels: ${sizeLabels.join(', ')}`);
for (const label of sizeLabels) {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: label,
});
}
console.log("Existing size labels removed.");
} else {
console.log("No existing size labels to remove.");
}
if (label) {
console.log(`Applying label "${label}" to the pull request...`);
await github.rest.issues.addLabels({
Expand Down

0 comments on commit 2c92bd6

Please sign in to comment.