Fix stale workflow: tighten thresholds and fix KBE close logic#54471
Conversation
The stale-known-build-errors job had a conflict between its two steps: - Step 1 added the 'stale' label and a comment - Step 2 (actions/stale) treated that comment as new activity, removing the stale label — creating an infinite loop of daily re-labeling Fix: Replace Step 2 with direct close logic in the github-script that checks when the stale label was applied via issue events and closes after 7 days. Also tighten stale thresholds (issues: 4y, PRs: 2mo). Fixes: dotnet#39172 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the repo’s stale automation to reduce the time before issues/PRs are marked stale, and fixes the Known Build Error (KBE) stale workflow so KBEs can actually be closed after remaining stale for a configured period (without the “comment activity removes stale label” loop).
Changes:
- Tighten global stale thresholds (issues ~4y, PRs ~2mo).
- Replace
actions/stale-based KBE closing withgithub-scriptlogic that closes KBEs after thestalelabel has been present for 7 days while monthly hits remain 0.
Fetch a single page (100 events) instead of paginating the entire issue event history. The stale label was applied by this workflow recently so it will always be in the last 100 events. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| - uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const CLOSE_AFTER_DAYS = 7; |
There was a problem hiding this comment.
suggestion: Rename this to CLOSE_KBE_AFTER_DAYS and move it to the top of the file under the env: declaration. It seems like that's where most configuration lives for this workflow.
There was a problem hiding this comment.
I renamed the const as suggested but left it in that location with a9f7aa9. The envs at the top are items that are shared across the jobs. The specific constants for the normal stale and KBE stale jobs are defined within each job.
Rename constant to CLOSE_KBE_AFTER_DAYS, use it in the notification message, and add whitespace between logical blocks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Merging ahead of validation since it doesn't cover the GH action. |
Summary
This PR contains two fixes for the stale issue workflow:
Tighten stale thresholds — Reduces issue staleness from ~4.5 years to ~4 years, and PR staleness from ~4 months to ~2 months.
Fix Known Build Error (KBE) issues never closing — The previous implementation had a conflict between its two steps:
stalelabel and a commentactions/stale) treated that comment as "new activity", removing thestalelabelThe fix replaces Step 2 with direct close logic in the github-script that checks when the stale label was applied via issue timeline events and closes after 7 days. This eliminates the dependency on
actions/stalefor KBE closure entirely.Validation
Tested on a fork with 4 scenarios:
Related to #54043, and #54044