Skip to content

pr.yaml: write protected config files as UTF-8 without BOM#98

Closed
Chris-Wolfgang wants to merge 4 commits into
mainfrom
fix/pr-yaml-bom-encoding-on-protected-config-fetch
Closed

pr.yaml: write protected config files as UTF-8 without BOM#98
Chris-Wolfgang wants to merge 4 commits into
mainfrom
fix/pr-yaml-bom-encoding-on-protected-config-fetch

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Backport of repo-template#339.

The 'Fetch trusted configuration files from main branch' step writes the protected configs back via Out-File -Encoding UTF8 (BOM-prefixed). The .NET analyzer engine appears to ignore BOM-prefixed .editorconfig files, so project severity overrides don't apply on CI — analyzers fire at default severity and TreatWarningsAsErrors escalates findings that pass locally.

This is a 4-line workflow-only change: UTF8UTF8NoBOM at the four call sites. PowerShell 6+ supports the encoding token; shell: pwsh runners use PS 7+, so it's safe.

Diagnosed against In-memory-Logger PR #32 / run 24996715587.

🤖 Generated with Claude Code

Backport of repo-template PR #339. The 'Fetch trusted configuration files
from main branch' step writes .editorconfig / Directory.Build.props /
BannedSymbols.txt back via 'Out-File -Encoding UTF8' which writes UTF-8
*with* BOM. The .NET analyzer engine appears to ignore .editorconfig
files prefixed by a BOM, so project-level severity overrides don't apply
on CI even though they apply locally — analyzers fire at default severity
and TreatWarningsAsErrors then escalates them to errors.

Switch to 'Out-File -Encoding UTF8NoBOM' (PS 6+; the runner uses pwsh).

Diagnosed against Chris-Wolfgang/In-memory-Logger PR #32 / run
24996715587. See Chris-Wolfgang/repo-template#339 for the full write-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 9, 2026 18:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 PR validation workflow to write trusted configuration files from main as UTF-8 without a BOM on Windows runners, to prevent BOM-prefixed .editorconfig from being ignored by .NET analyzers in CI.

Changes:

  • Switch Out-File -Encoding UTF8 to Out-File -Encoding UTF8NoBOM at four call sites in the Windows “Fetch trusted configuration files from main branch” scripts.

Comment thread .github/workflows/pr.yaml Outdated
Chris-Wolfgang and others added 2 commits May 9, 2026 14:21
main (#346 in repo-template, synced down) removed the duplicated
"Fetch trusted configuration files from main branch" step from each
job. This branch had applied the UTF8NoBOM encoding fix to both
copies. Resolution: keep main's deduped layout — the surviving
single occurrence already carries the BOM fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 14, 2026 02:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@Chris-Wolfgang

Copy link
Copy Markdown
Owner Author

Superseded by the C1 template-drift re-sync. The canonical repo-template pr.yaml already writes protected config files with -Encoding UTF8NoBOM. PR #135 re-syncs pr.yaml from canonical, delivering this fix. Closing as superseded; deleting the branch.

@Chris-Wolfgang Chris-Wolfgang deleted the fix/pr-yaml-bom-encoding-on-protected-config-fetch branch May 22, 2026 15:12
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.

2 participants