Skip to content

Commit 21b76da

Browse files
committed
Handle state_reason "duplicate"
1 parent c110619 commit 21b76da

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

.github/workflows/sanitize-closed-issues.yml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
labels: newLabels,
2929
});
3030
}
31-
if (issue.data.state_reason === "not_planned") {
31+
if (issue.data.state_reason === "not_planned" || issue.data.state_reason === "duplicate") {
3232
if (issue.data.milestone) {
3333
await github.rest.issues.update({
3434
issue_number: issue.data.number,
@@ -39,18 +39,28 @@ jobs:
3939
}
4040
const statusLabels = newLabels.filter(l => l.startsWith("status: "));
4141
if (statusLabels.length === 0) {
42-
await github.rest.issues.createComment({
43-
issue_number: issue.data.number,
44-
owner: context.repo.owner,
45-
repo: context.repo.repo,
46-
body: "Please assign a status label to this issue.",
47-
});
48-
await github.rest.issues.update({
49-
issue_number: issue.data.number,
50-
owner: context.repo.owner,
51-
repo: context.repo.repo,
52-
state: "open",
53-
});
42+
if (issue.data.state_reason === "not_planned") {
43+
await github.rest.issues.createComment({
44+
issue_number: issue.data.number,
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
body: "Please assign a status label to this issue.",
48+
});
49+
await github.rest.issues.update({
50+
issue_number: issue.data.number,
51+
owner: context.repo.owner,
52+
repo: context.repo.repo,
53+
state: "open",
54+
});
55+
} else {
56+
newLabels.push("status: duplicate");
57+
await github.rest.issues.update({
58+
issue_number: issue.data.number,
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
labels: newLabels,
62+
});
63+
}
5464
}
5565
} else {
5666
if (!(newLabels.includes("type: task") || newLabels.includes("type: question")) && !issue.data.milestone) {

0 commit comments

Comments
 (0)