Skip to content

Commit 3583887

Browse files
committed
Make duplicate issue grace period configurable, default to 7 days
Read from repo variable DUPLICATE_GRACE_DAYS (default 7) instead of hardcoded 3 days for both auto-close workflow and comment script. Signed-off-by: Heng Qian <qianheng@amazon.com>
1 parent 22d28e3 commit 3583887

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/auto-close-duplicates.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ jobs:
1515
steps:
1616
- name: Close stale duplicate issues
1717
uses: actions/github-script@v7
18+
env:
19+
GRACE_DAYS: ${{ vars.DUPLICATE_GRACE_DAYS || '7' }}
1820
with:
1921
script: |
2022
const { owner, repo } = context.repo;
21-
const THREE_DAYS_MS = 3 * 24 * 60 * 60 * 1000;
23+
const graceDays = parseInt(process.env.GRACE_DAYS, 10) || 7;
24+
const GRACE_PERIOD_MS = graceDays * 24 * 60 * 60 * 1000;
2225
const now = Date.now();
2326
2427
// Find all open issues with the duplicate label
@@ -58,8 +61,8 @@ jobs:
5861
const lastDupeComment = dupeComments[dupeComments.length - 1];
5962
const dupeCommentAge = now - new Date(lastDupeComment.created_at).getTime();
6063
61-
if (dupeCommentAge < THREE_DAYS_MS) {
62-
const daysLeft = ((THREE_DAYS_MS - dupeCommentAge) / (24 * 60 * 60 * 1000)).toFixed(1);
64+
if (dupeCommentAge < GRACE_PERIOD_MS) {
65+
const daysLeft = ((GRACE_PERIOD_MS - dupeCommentAge) / (24 * 60 * 60 * 1000)).toFixed(1);
6366
console.log(` Duplicate comment is too recent (${daysLeft} days remaining), skipping`);
6467
continue;
6568
}

.github/workflows/claude-dedupe-issues.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
env:
3535
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3636
GITHUB_REPOSITORY: ${{ github.repository }}
37+
DUPLICATE_GRACE_DAYS: ${{ vars.DUPLICATE_GRACE_DAYS }}
3738
with:
3839
use_bedrock: "true"
3940
github_token: ${{ secrets.GITHUB_TOKEN }}

scripts/comment-on-duplicates.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ If this is **not** a duplicate:
7171
- Add a comment on this issue, and the \`duplicate\` label will be removed automatically, or
7272
- 👎 this comment to prevent auto-closure
7373
74-
Otherwise, this issue will be **automatically closed in 3 days**.
74+
Otherwise, this issue will be **automatically closed in ${DUPLICATE_GRACE_DAYS:-7} days**.
7575
7676
🤖 Generated with [Claude Code](https://claude.ai/code)"
7777

0 commit comments

Comments
 (0)