Skip to content

Commit c6f3a77

Browse files
committed
fix(windows build): fix missing SLSA provenance file
1 parent c124cc4 commit c6f3a77

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

.github/workflows/windows_build.yml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ jobs:
105105
ls Output
106106
107107
- name: Generate GitHub Actions build provenance
108+
id: gh_provenance_step # Added id
108109
uses: actions/[email protected]
109110
with:
110111
subject-path: windows/Output/*.exe
@@ -159,21 +160,42 @@ jobs:
159160
- name: Debug SLSA provenance files
160161
run: |
161162
Write-Host "Looking for provenance files..."
163+
$ghProvenanceFile = "${{ steps.gh_provenance_step.outputs.bundle-path }}"
164+
if ($ghProvenanceFile) {
165+
Write-Host "Expected provenance file from gh_provenance_step: $ghProvenanceFile"
166+
if (Test-Path $ghProvenanceFile) {
167+
Write-Host "Found it at the expected path."
168+
} else {
169+
Write-Host "::warning::Expected provenance file from gh_provenance_step NOT FOUND at path: $ghProvenanceFile"
170+
}
171+
} else {
172+
Write-Host "::warning::No bundle-path output from gh_provenance_step."
173+
}
162174
$files = Get-ChildItem -Path ".", "..", "../.." -Recurse -Filter "*.intoto.jsonl" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
163-
Write-Host "Found provenance files:"
175+
Write-Host "Found provenance files via general search:"
164176
$files | ForEach-Object { Write-Host $_ }
165177
166178
- name: Verify SLSA Provenance
167179
continue-on-error: true
168180
run: |
169-
# Find the provenance file correctly
170-
$provenance = Get-ChildItem -Path "." -Filter "*.intoto.jsonl" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
171-
if (-not $provenance) {
172-
# Try a broader search but exclude test files
173-
$provenance = Get-ChildItem -Path ".", "..", "../.." -Recurse -Filter "*.intoto.jsonl" -ErrorAction SilentlyContinue |
174-
Where-Object { $_.FullName -notlike "*\testdata\*" -and $_.FullName -notlike "*\test\*" } |
175-
Select-Object -First 1 -ExpandProperty FullName
181+
$provenance = ""
182+
$ghProvenanceFile = "${{ steps.gh_provenance_step.outputs.bundle-path }}"
183+
184+
if (-not ([string]::IsNullOrEmpty($ghProvenanceFile)) -and (Test-Path $ghProvenanceFile)) {
185+
$provenance = $ghProvenanceFile
186+
Write-Host "Using provenance file from 'Generate GitHub Actions build provenance' step: $provenance"
187+
} else {
188+
Write-Host "::warning::Provenance file from 'Generate GitHub Actions build provenance' step output not found (path: '$ghProvenanceFile'). Falling back to search..."
189+
# Fallback: Find the provenance file using existing search logic
190+
$provenance = Get-ChildItem -Path "." -Filter "*.intoto.jsonl" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
191+
if (-not $provenance) {
192+
# Try a broader search but exclude test files
193+
$provenance = Get-ChildItem -Path ".", "..", "../.." -Recurse -Filter "*.intoto.jsonl" -ErrorAction SilentlyContinue |
194+
Where-Object { $_.FullName -notlike "*\\\\testdata\\\\*" -and $_.FullName -notlike "*\\\\test\\\\*" } |
195+
Select-Object -First 1 -ExpandProperty FullName
196+
}
176197
}
198+
177199
if (-not $provenance) {
178200
Write-Host "::warning::SLSA provenance file not found, skipping verification"
179201
exit 0 # Don't fail the build, but warn about it

0 commit comments

Comments
 (0)