-
Notifications
You must be signed in to change notification settings - Fork 618
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
Co-authored-by: mtfriesen <[email protected]>
Co-authored-by: mtfriesen <[email protected]>
Co-authored-by: mtfriesen <[email protected]>
Co-authored-by: mtfriesen <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5577 +/- ##
==========================================
- Coverage 85.85% 85.57% -0.28%
==========================================
Files 59 59
Lines 18622 18622
==========================================
- Hits 15988 15936 -52
- Misses 2634 2686 +52 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| console.log(` Adding final warning (${daysSinceUpdate} days inactive)`); | ||
|
|
||
| try { | ||
| await github.rest.issues.createComment({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if these comments will refresh the "last updated" date?
|
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. |
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.