Skip to content

Fix stale Known Build Error workflow (CRLF regex bug)#54174

Merged
marcpopMSFT merged 2 commits intodotnet:mainfrom
MichaelSimons:dev/fix-stale-kbe-workflow
May 5, 2026
Merged

Fix stale Known Build Error workflow (CRLF regex bug)#54174
marcpopMSFT merged 2 commits intodotnet:mainfrom
MichaelSimons:dev/fix-stale-kbe-workflow

Conversation

@MichaelSimons
Copy link
Copy Markdown
Member

@MichaelSimons MichaelSimons commented May 4, 2026

Problem

The stale-known-build-errors job in the stale workflow was silently failing to match any issues. No Known Build Error issues were ever being labeled stale, regardless of their hit counts.

Root Cause

GitHub issue bodies use CRLF line endings (\r\n), but the regex used bare \n to match line breaks in the hit count table. This caused the regex to never match, so the job would iterate over all issues but skip every one.

Fix

  • CRLF regex: Change \n to \r?\n in the table-matching regex
  • Diagnostic logging: Add console.log statements so future issues are visible in workflow run logs
  • Manual trigger: Add workflow_dispatch to allow on-demand runs for testing/verification

Validation

Tested on MichaelSimons/sdk fork with synthetic test issues:

  • Issue with 0 monthly hits → correctly labeled stale with comment
  • Issue with 12 monthly hits → correctly left alone
  • Issue with no hit count table → correctly skipped

Related to #54017

MichaelSimons and others added 2 commits May 4, 2026 20:38
- Fix regex to handle \r\n line endings in issue bodies
- Add console.log for debugging
- Allow running on MichaelSimons fork for testing
- Add workflow_dispatch trigger

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The stale-known-build-errors job was silently failing because GitHub
issue bodies use CRLF line endings (\r\n) but the regex used \n.
This caused the hit count table to never match, so no issues were
ever labeled stale.

Changes:
- Fix regex to handle CRLF: \n → \r?\n
- Add diagnostic console.log statements for troubleshooting
- Add workflow_dispatch trigger to allow manual runs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MichaelSimons MichaelSimons marked this pull request as ready for review May 4, 2026 20:43
Copilot AI review requested due to automatic review settings May 4, 2026 20:43
@MichaelSimons MichaelSimons requested a review from lbussell May 4, 2026 20:45
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

Updates the stale-issue workflow logic for Known Build Error (KBE) issues so the automation can correctly parse the hit-count table from issue bodies and apply/remove the stale label as intended.

Changes:

  • Fix hit-count table parsing by updating the regex to handle CRLF (\r?\n) line endings.
  • Add diagnostic console.log output to make matching/labeling decisions visible in workflow logs.
  • Add workflow_dispatch to allow manually triggered runs.

Comment thread .github/workflows/stale.yml
@MichaelSimons MichaelSimons requested a review from a team May 5, 2026 02:42
Copy link
Copy Markdown
Member

@nagilson nagilson left a comment

Choose a reason for hiding this comment

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

Thank you for this!

@marcpopMSFT marcpopMSFT merged commit 89383d2 into dotnet:main May 5, 2026
30 checks passed
@MichaelSimons MichaelSimons deleted the dev/fix-stale-kbe-workflow branch May 5, 2026 20:18
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