Skip to content

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

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

pr.yaml: write protected config files as UTF-8 without BOM#106
Chris-Wolfgang wants to merge 2 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:16

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Chris-Wolfgang

Copy link
Copy Markdown
Owner Author

Closing — superseded by PR #110, a single comprehensive sync of all files that had drifted from canonical repo-template/main. The piecemeal approach (one PR per file) had fallen behind canonical's continued evolution; consolidating into one PR is cleaner.

Chris-Wolfgang pushed a commit that referenced this pull request May 10, 2026
Bulk sync of all files where Try-Pattern had drifted from canonical
repo-template/main as of today (2026-05-10). Supersedes the 4 in-flight
piecemeal sync PRs (#104, #105, #106, #109), which each covered only a
slice of one file's drift.

Files changed:

- .editorconfig: drop redundant [*.ps1] indent_size = 4 block (global
  [*] already sets indent_size = 4); reword PowerShell comment for
  accuracy.

- .gitattributes: enforce *.ps1 eol=lf (was just text); reword comment
  to clarify BOM-free encoding is .editorconfig's job, not gitattribute's.

- .github/workflows/pr.yaml: dedup the duplicated 'Fetch trusted
  configuration files from main branch' step that was repeated across
  jobs; add Dependabot guard to the Windows job's variant; UTF-8 (no
  BOM) writes for protected config fetches.

- .github/workflows/docfx.yaml: gh-pages bootstrap fix (initialize
  empty repo when gh-pages doesn't exist); try/finally extraheader
  cleanup so the encoded GITHUB_TOKEN never leaks past the deploy
  step; explicit 'exit $deployExitCode' after finally so failed
  deploys actually fail the step (was being silently swallowed); ls-
  remote failure detection so a transient network/auth failure can't
  silently bootstrap over an existing gh-pages branch.

- scripts/Setup-Labels.ps1: add #!/usr/bin/env pwsh shebang.

- scripts/Setup-GitHubPages.ps1: minor sync (small drift).

- docs/README-FORMATTING.md, docs/RELEASE-WORKFLOW-SETUP.md,
  docs/WORKFLOW_SECURITY.md: new from canonical (Try-Pattern's /docs/
  was previously just a placeholder index.html).

Touches several protected files (.editorconfig, .gitattributes,
.github/workflows/*) so the 'Detect .NET Projects' guard will block
auto-merge — maintainer override required.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Chris-Wolfgang Chris-Wolfgang deleted the fix/pr-yaml-bom-encoding-on-protected-config-fetch branch June 27, 2026 21:17
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