Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 7, 2025

Description

Implements automated cleanup of inactive PRs to address the backlog of 69+ open PRs, many stale for months or years.

Workflow behavior:

  • Day 46: First warning comment + stale label
  • Day 53: Final warning comment + stale-final-warning label
  • Day 60: PR auto-closed with notification
  • Updated PRs have stale labels automatically removed

Exemptions:
PRs labeled pinned, security, or dependencies are never auto-closed.

Schedule:
Runs daily at 00:00 UTC via cron, manually triggerable via workflow_dispatch.

Implementation:
Uses actions/github-script@v7 for 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

This section details on the original issue you should resolve

<issue_title>Stale PRs should be auto-closed</issue_title>
<issue_description>### Describe the feature you'd like supported

We have 69 active PRs into MsQuic, and many of them haven't been updated for months or years. We should clean those up and stay clean.

Proposed solution

Add a periodic action that scans for PRs not modified within 60 days and closes those PRs. The PR author should be notified 2 weeks and 1 week before it gets closed.

Additional context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add auto-close feature for stale PRs Add workflow to auto-close stale PRs after 60 days Nov 7, 2025
Copilot AI requested a review from mtfriesen November 7, 2025 18:32
Copilot finished work on behalf of mtfriesen November 7, 2025 18:32
Copilot AI requested a review from mtfriesen November 7, 2025 18:44
Copilot finished work on behalf of mtfriesen November 7, 2025 18:44
@mtfriesen mtfriesen marked this pull request as ready for review November 7, 2025 18:47
@mtfriesen mtfriesen requested a review from a team as a code owner November 7, 2025 18:47
@codecov
Copy link

codecov bot commented Nov 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.57%. Comparing base (f5eddcc) to head (6433d8e).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mtfriesen mtfriesen enabled auto-merge (squash) November 7, 2025 21:10
console.log(` Adding final warning (${daysSinceUpdate} days inactive)`);

try {
await github.rest.issues.createComment({
Copy link
Contributor

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?

@anrossi
Copy link
Collaborator

anrossi commented Nov 10, 2025

Will this immediately close all currently stale PRs? Or will it start the clock from when it first runs?

@mtfriesen
Copy link
Contributor

mtfriesen commented Nov 10, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stale PRs should be auto-closed

4 participants