Skip to content

Commit b042c78

Browse files
committed
Added more logging to dsl to sonar
1 parent 6b54965 commit b042c78

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

.github/workflows/azure-static-web-apps.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,40 @@ jobs:
3232
shell: pwsh
3333
run: |
3434
./Convert-DslToArchitecture.ps1 -OutputPath architecture.generated.json
35-
$generated = (Get-Content architecture.generated.json -Raw).Trim() -replace "`r`n", "`n"
36-
$committed = (Get-Content architecture.json -Raw).Trim() -replace "`r`n", "`n"
37-
Remove-Item architecture.generated.json
35+
36+
$rawGenerated = Get-Content architecture.generated.json -Raw
37+
$rawCommitted = Get-Content architecture.json -Raw
38+
39+
Write-Host "=== generated: $($rawGenerated.Length) chars, first byte: $([int][char]$rawGenerated[0])"
40+
Write-Host "=== committed: $($rawCommitted.Length) chars, first byte: $([int][char]$rawCommitted[0])"
41+
42+
$generated = $rawGenerated.Trim() -replace "`r`n", "`n" -replace "`r", "`n"
43+
$committed = $rawCommitted.Trim() -replace "`r`n", "`n" -replace "`r", "`n"
44+
45+
Write-Host "=== generated normalised: $($generated.Length) chars"
46+
Write-Host "=== committed normalised: $($committed.Length) chars"
47+
3848
if ($generated -ne $committed) {
49+
# Show first differing line
50+
$genLines = $generated -split "`n"
51+
$comLines = $committed -split "`n"
52+
$maxLines = [Math]::Max($genLines.Count, $comLines.Count)
53+
for ($i = 0; $i -lt $maxLines; $i++) {
54+
$g = if ($i -lt $genLines.Count) { $genLines[$i] } else { '<missing>' }
55+
$c = if ($i -lt $comLines.Count) { $comLines[$i] } else { '<missing>' }
56+
if ($g -ne $c) {
57+
Write-Host "=== first diff at line $($i+1)"
58+
Write-Host " generated: $g"
59+
Write-Host " committed: $c"
60+
break
61+
}
62+
}
63+
Remove-Item architecture.generated.json
3964
Write-Host "::error::architecture.json is out of sync with workspace.dsl. Run .\Convert-DslToArchitecture.ps1 locally and commit the result."
4065
exit 1
4166
}
67+
68+
Remove-Item architecture.generated.json
4269
Write-Host "architecture.json matches workspace.dsl"
4370
4471
- name: Build React app

0 commit comments

Comments
 (0)