Shorten stal action to 3 months

This commit is contained in:
Jaret Burkett committed 2026-03-25 10:42:18 -06:00
1 parent 45647c15d3
commit 3f7a3d8d87
1 file changed
+6 -6
+6 -6
View File
@@ -17,8 +17,8 @@ jobs:
uses: actions/github-script@v7 uses: actions/github-script@v7
with: with:
script: | script: |
const sixMonthsAgo = new Date(); const threeMonthsAgo = new Date();
sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6); threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);
let closedIssues = 0; let closedIssues = 0;
let closedPRs = 0; let closedPRs = 0;
@@ -39,14 +39,14 @@ jobs:
// Skip pull requests (issues API returns both) // Skip pull requests (issues API returns both)
if (issue.pull_request) continue; if (issue.pull_request) continue;
if (new Date(issue.updated_at) < sixMonthsAgo) { if (new Date(issue.updated_at) < threeMonthsAgo) {
console.log(`Closing issue #${issue.number}: "${issue.title}" (last activity: ${issue.updated_at})`); console.log(`Closing issue #${issue.number}: "${issue.title}" (last activity: ${issue.updated_at})`);
await github.rest.issues.createComment({ await github.rest.issues.createComment({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
body: `This issue has been automatically closed due to inactivity. It has had no activity for 6 months.\n\nIf this issue is still relevant, please feel free to reopen it with updated information or context. We apologize for any inconvenience.`, body: `This issue has been automatically closed due to inactivity. It has had no activity for 3 months.\n\nIf this issue is still relevant, please feel free to reopen it with updated information or context. We apologize for any inconvenience.`,
}); });
await github.rest.issues.update({ await github.rest.issues.update({
@@ -75,14 +75,14 @@ jobs:
for await (const { data: prs } of prIterator) { for await (const { data: prs } of prIterator) {
for (const pr of prs) { for (const pr of prs) {
if (new Date(pr.updated_at) < sixMonthsAgo) { if (new Date(pr.updated_at) < threeMonthsAgo) {
console.log(`Closing PR #${pr.number}: "${pr.title}" (last activity: ${pr.updated_at})`); console.log(`Closing PR #${pr.number}: "${pr.title}" (last activity: ${pr.updated_at})`);
await github.rest.issues.createComment({ await github.rest.issues.createComment({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: pr.number, issue_number: pr.number,
body: `This pull request has been automatically closed due to inactivity. It has had no activity for 6 months.\n\nIf this PR is still relevant, please feel free to reopen it with updated information or context. We apologize for any inconvenience.`, body: `This pull request has been automatically closed due to inactivity. It has had no activity for 3 months.\n\nIf this PR is still relevant, please feel free to reopen it with updated information or context. We apologize for any inconvenience.`,
}); });
await github.rest.pulls.update({ await github.rest.pulls.update({