Skip to content

Commit 6bc20af

Browse files
committed
Only add "status: new" label for issues without another status label
1 parent 5edbcbe commit 6bc20af

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/label-opened-issues.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,18 @@ jobs:
1212
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
1313
with:
1414
script: |
15-
github.rest.issues.addLabels({
15+
const issue = await github.rest.issues.get({
1616
issue_number: context.issue.number,
1717
owner: context.repo.owner,
1818
repo: context.repo.repo,
19-
labels: ["status: new"]
20-
})
19+
});
20+
const originalLabels = issue.data.labels.map(l => l.name);
21+
const statusLabels = originalLabels.filter(l => l.startsWith("status: "));
22+
if (statusLabels.length === 0) {
23+
github.rest.issues.addLabels({
24+
issue_number: context.issue.number,
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
labels: ["status: new"]
28+
})
29+
}

0 commit comments

Comments
 (0)