Skip to content

Commit ffde926

Browse files
authored
Pin and check the hash of yq on Windows (#1892)
* Pin version and check checksum of yq dependency on Windows * Rename yq-latest
1 parent febb540 commit ffde926

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/build-wheel.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,19 @@ jobs:
8484
# see https://github.com/actions/runner-images/issues/7443.
8585
if: ${{ startsWith(inputs.host-platform, 'win') }}
8686
env:
87-
# doesn't seem there's an easy way to avoid hard-coding it?
88-
YQ_URL: https://github.com/mikefarah/yq/releases/latest/download/yq_windows_amd64.exe
89-
YQ_DIR: yq_latest
87+
YQ_VERSION: v4.52.5
88+
YQ_SHA256: 47594981f3848a4b4447494adeca9555f908f7cf0a89c4da3fd0243a4631da1c
89+
YQ_DIR: yq
9090
shell: pwsh -command ". '{0}'"
9191
run: |
92+
$yqUrl = "https://github.com/mikefarah/yq/releases/download/${env:YQ_VERSION}/yq_windows_amd64.exe"
9293
mkdir -Force -ErrorAction SilentlyContinue "${env:YQ_DIR}" | Out-Null
93-
Invoke-WebRequest -UseBasicParsing -OutFile "${env:YQ_DIR}/yq.exe" -Uri "$env:YQ_URL"
94+
Invoke-WebRequest -UseBasicParsing -OutFile "${env:YQ_DIR}/yq.exe" -Uri "$yqUrl"
95+
$hash = (Get-FileHash -Algorithm SHA256 "${env:YQ_DIR}/yq.exe").Hash.ToLower()
96+
if ($hash -ne $env:YQ_SHA256) {
97+
Write-Error "SHA256 mismatch for yq: expected $env:YQ_SHA256, got $hash"
98+
exit 1
99+
}
94100
ls -l $env:YQ_DIR
95101
echo "$((Get-Location).Path)\\$env:YQ_DIR" >> $env:GITHUB_PATH
96102
$env:Path += ";$((Get-Location).Path)\\$env:YQ_DIR"

0 commit comments

Comments
 (0)