Skip to content

Commit 70e493d

Browse files
committed
don't add label if it already exists
1 parent 514b35a commit 70e493d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.github/workflows/tagPriorityLow.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,26 @@ jobs:
6767

6868
// Add priority-low label to GitHub issues
6969
const addLowPriorityLabel = async (issueNumber) => {
70+
// Check if the issue already has the label
71+
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
72+
issue_number: issueNumber,
73+
owner: context.repo.owner,
74+
repo: context.repo.repo
75+
});
76+
77+
if (labels.some(l => l.name === 'priority-low')) {
78+
console.log(`Issue #${issueNumber} already has the label`);
79+
return;
80+
}
81+
82+
// Add the label
7083
await github.rest.issues.addLabels({
7184
issue_number: issueNumber,
7285
owner: context.repo.owner,
7386
repo: context.repo.repo,
7487
labels: ['priority-low']
7588
});
89+
console.log(`Added label to issue #${issueNumber}`);
7690
}
7791

7892
ghIssueNumbers.forEach(async (issueNumber) => {

0 commit comments

Comments
 (0)