Skip to content

Auto-close stale Known Build Error issues with zero monthly hits#54017

Merged
MichaelSimons merged 2 commits intomainfrom
stale-kbe-automation
Apr 22, 2026
Merged

Auto-close stale Known Build Error issues with zero monthly hits#54017
MichaelSimons merged 2 commits intomainfrom
stale-kbe-automation

Conversation

@MichaelSimons
Copy link
Copy Markdown
Member

@MichaelSimons MichaelSimons commented Apr 21, 2026

Summary

Adds automation to the existing stale workflow that closes Known Build Error (KBE) issues that have had 0 hits for over a month.

How it works

  1. Step 1 (github-script): Scans open KBE issues, parses the hit count table from each issue body. If 1-month count is 0 → adds stale label + comment. If hits have resumed on a stale issue → removes stale label.

  2. Step 2 (actions/stale): Closes KBE issues that have been stale for 7+ days.

  3. Existing stale job: Now exempts KBE issues via exempt-issue-labels to avoid conflicts.

Opting out with keep-open

The standard escape hatches don't work here:

  • Removing stale — the automation re-applies it on the next run as long as the 1-month hit count is 0.
  • Removing Known Build Error — changes the issue's meaning; the issue is still a known build error, you just don't want it auto-closed.

Instead, add the keep-open label to any KBE issue that should remain open despite zero hits. The script skips issues with this label entirely.

Changes

  • .github/workflows/stale.yml: Added stale-known-build-errors job, added env.KBE_LABEL shared variable, added exempt-issue-labels to existing stale job.

Testing

Tested on fork (MichaelSimons/sdk) with workflow_dispatch and sample issues. Verified:

  • Zero-hit issues get stale label and comment
  • Active-hit issues are skipped
  • Resumed-hit stale issues get stale label removed
  • Stale issues are closed by actions/stale

Affected Issues

Once merged, the following issues will be marked as stale and closed:

Copilot AI review requested due to automatic review settings April 21, 2026 17:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GitHub Actions automation to identify and close stale Known Build Error (KBE) issues based on a “0 hits in the last month” signal, while preventing the repo’s general stale workflow from acting on KBEs.

Changes:

  • Added a shared KBE_LABEL env var and exempted KBE issues from the existing actions/stale job.
  • Added a stale-known-build-errors job that:
    • uses actions/github-script to apply/remove the stale label based on parsed monthly hit count
    • uses actions/stale to close KBE issues that have been stale for 7+ days

Comment thread .github/workflows/stale.yml
Comment thread .github/workflows/stale.yml Outdated
Comment thread .github/workflows/stale.yml
@MichaelSimons MichaelSimons force-pushed the stale-kbe-automation branch 3 times, most recently from 6b2a6ee to 735d9ae Compare April 21, 2026 17:34
Add a stale-known-build-errors job to the existing stale workflow that:
- Labels open Known Build Error issues as 'stale' when their 1-month
  hit count is 0
- Removes the 'stale' label if hit counts resume
- Uses actions/stale to close issues that remain stale for 7+ days
- Exempts KBE issues from the main stale job to avoid conflicts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread .github/workflows/stale.yml Outdated
Address review feedback from lbussell: make 'keep-open' and 'stale'
labels env vars (STALE_LABEL, KEEP_OPEN_LABEL) just like KBE_LABEL.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MichaelSimons
Copy link
Copy Markdown
Member Author

Merging ahead of validation since it doesn't cover the stale action.

@MichaelSimons MichaelSimons merged commit fc67450 into main Apr 22, 2026
16 of 24 checks passed
@MichaelSimons MichaelSimons deleted the stale-kbe-automation branch April 22, 2026 16:55
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.

4 participants