From 3bf15fe5e6170df84f4031beaf06a55b128cdfe6 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 16:42:38 -0800 Subject: [PATCH] Packaging: the Windows signing test does not turn its expected warning into an annotation The stable optional-signing case in nightly-signing-tests.ps1 calls sign.ps1 with no signing variables set. On a runner, GITHUB_ACTIONS is set, so sign.ps1 printed "Windows signing secrets not set" as a ::warning:: workflow command, and every nightly-check run showed it as a warning annotation. The test now clears GITHUB_ACTIONS for that call and restores it after. It reads the line from the warning stream and fails when the warning is missing or when the call prints a workflow command. --- packaging/windows/nightly-signing-tests.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packaging/windows/nightly-signing-tests.ps1 b/packaging/windows/nightly-signing-tests.ps1 index 51a8e2ade9..60d2fa420f 100644 --- a/packaging/windows/nightly-signing-tests.ps1 +++ b/packaging/windows/nightly-signing-tests.ps1 @@ -84,7 +84,14 @@ try { $file = Join-Path $root 'owned-sentinel.exe' [IO.File]::WriteAllText($file, 'generated sentinel, not a real executable') $before = (Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash - & $sign -Files $file + # With GITHUB_ACTIONS set, sign.ps1 prints its unsigned-files warning as a workflow annotation. + # The test clears it for this call, reads the warning from the warning stream and restores it. + $actions = $env:GITHUB_ACTIONS + $env:GITHUB_ACTIONS = $null + try { $signOutput = @(& $sign -Files $file 3>&1) } finally { $env:GITHUB_ACTIONS = $actions } + $warnings = @($signOutput | Where-Object { $_ -is [Management.Automation.WarningRecord] }) + Assert-Policy ($warnings.Count -eq 1 -and $warnings[0].Message.Contains('Windows signing secrets not set')) 'optional stable policy did not warn about unsigned files' + Assert-Policy (-not ($signOutput | Where-Object { "$_".StartsWith('::') })) 'optional stable policy printed a workflow command' Assert-Policy ((Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash -ceq $before) 'optional stable policy changed unsigned bytes' Write-Output 'PASS: stable-optional-policy-preserves-owned-bytes' } finally {