From f1155437c466fc0563d5d137bf8b4b7a92d75af1 Mon Sep 17 00:00:00 2001 From: Chris Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com> Date: Sat, 9 May 2026 14:15:35 -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 24e88a3..e64ea3d 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -582,7 +582,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" } @@ -597,7 +597,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 } } } @@ -627,7 +627,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" } @@ -642,7 +642,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 } } }