Skip to content

Commit c64ad56

Browse files
JusterZhuclaude
andcommitted
fix: insert entry point before first /// <summary> only
PowerShell -replace replaces ALL regex matches, inserting the entry point before every /// <summary> in the file. FullIntegration.cs has two <summary> comments (main class + UpgradeProcessIntegration class), causing 'Top-level statements must precede namespace and type declarations'. Use IndexOf + Insert instead for single-match insertion. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 54e3325 commit c64ad56

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ jobs:
166166
$entryPoint = "// Entry point for build verification$nl" +
167167
"Console.WriteLine(""Verifying $templateName compiles..."");$nl" +
168168
"await $templateName.RunAsync();$nl"
169-
# Insert before the first /// documentation comment
170-
$code = $code -replace '(?=/// <summary>)', "$entryPoint$nl"
169+
# Insert before the first /// documentation comment only (single match)
170+
$pos = $code.IndexOf('/// <summary>')
171+
if ($pos -ge 0) { $code = $code.Insert($pos, "$entryPoint$nl") }
171172
$code | Out-File -FilePath "$testDir\Program.cs" -Encoding UTF8
172173
173174
Write-Host "=== Verifying: $templateName ==="

0 commit comments

Comments
 (0)