-
Notifications
You must be signed in to change notification settings - Fork 628
Add workflow to auto-close stale PRs after 60 days #5577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5577 +/- ##
==========================================
- Coverage 86.34% 84.99% -1.35%
==========================================
Files 60 60
Lines 18663 18663
==========================================
- Hits 16114 15863 -251
- Misses 2549 2800 +251 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Will this immediately close all currently stale PRs? Or will it start the clock from when it first runs? |
Yeah I also wondered about its first run vs periodically going forward. I think it might insta-close the current PRs, which are still old, and can still be reactivated if that were to occur and the author wants to bring it back. |
|
Updated the script with a simplified logic (it gets annoying to track state otherwise):
|
The new script won't close all stale PRs immediately, but it will set the stale label immediately (starting the 2 weeks countdown) |
Co-authored-by: mtfriesen <[email protected]>
Co-authored-by: mtfriesen <[email protected]>
Co-authored-by: mtfriesen <[email protected]>
Co-authored-by: mtfriesen <[email protected]>
f40f439 to
17698a2
Compare
Description
Implements automated cleanup of inactive PRs to address the backlog of 69+ open PRs, many stale for months or years.
Workflow behavior:
stalelabelstale-final-warninglabelExemptions:
PRs labeled
pinned,security, ordependenciesare never auto-closed.Schedule:
Runs daily at 00:00 UTC via cron, manually triggerable via workflow_dispatch.
Implementation:
Uses
actions/github-script@v7for custom logic with full error handling and logging. Processes all open PRs via pagination.Testing
No existing tests. Workflow syntax validated. Logic tested with mock data to verify correct behavior at each threshold (46/53/60 days).
Documentation
No documentation changes needed. Workflow is self-documenting via inline comments.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.