From f407b3a014f3f69ef2980780654d64e2cbb96a2d Mon Sep 17 00:00:00 2001 From: Chris Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com> Date: Sat, 9 May 2026 14:14:41 -0400 Subject: [PATCH] pr.yaml: write protected config files as UTF-8 without BOM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .github/workflows/pr.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index e19b28c..70ee71d 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -636,7 +636,7 @@ jobs: $exists = git cat-file -e "main-branch:$configFile" 2>&1 if ($LASTEXITCODE -eq 0) { Write-Host " ✓ Copying $configFile from main branch" - git show "main-branch:$configFile" | Out-File -FilePath $configFile -Encoding UTF8 -NoNewline + git show "main-branch:$configFile" | Out-File -FilePath $configFile -Encoding UTF8NoBOM -NoNewline } else { Write-Host " ℹ️ $configFile not found in main branch, skipping" } @@ -651,7 +651,7 @@ jobs: Write-Host " ✓ Copying $file from main branch" $dir = Split-Path -Parent $file if ($dir) { New-Item -ItemType Directory -Force -Path $dir | Out-Null } - git show "main-branch:$file" | Out-File -FilePath $file -Encoding UTF8 -NoNewline + git show "main-branch:$file" | Out-File -FilePath $file -Encoding UTF8NoBOM -NoNewline } } } @@ -681,7 +681,7 @@ jobs: $exists = git cat-file -e "main-branch:$configFile" 2>&1 if ($LASTEXITCODE -eq 0) { Write-Host " ✓ Copying $configFile from main branch" - git show "main-branch:$configFile" | Out-File -FilePath $configFile -Encoding UTF8 -NoNewline + git show "main-branch:$configFile" | Out-File -FilePath $configFile -Encoding UTF8NoBOM -NoNewline } else { Write-Host " ℹ️ $configFile not found in main branch, skipping" } @@ -696,7 +696,7 @@ jobs: Write-Host " ✓ Copying $file from main branch" $dir = Split-Path -Parent $file if ($dir) { New-Item -ItemType Directory -Force -Path $dir | Out-Null } - git show "main-branch:$file" | Out-File -FilePath $file -Encoding UTF8 -NoNewline + git show "main-branch:$file" | Out-File -FilePath $file -Encoding UTF8NoBOM -NoNewline } } }