Skip to content

Commit 81acd22

Browse files
authored
ci: verify zstd checksum (#4396)
1 parent fb720ab commit 81acd22

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.github/actions/install-zstd/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ inputs:
88
description: 'zstd version'
99
required: false
1010
default: '1.5.7'
11+
checksum:
12+
description: 'zstd checksum'
13+
required: false
14+
default: 'acb4e8111511749dc7a3ebedca9b04190e37a17afeb73f55d4425dbf0b90fad9'
1115

1216
runs:
1317
using: composite
@@ -17,10 +21,16 @@ runs:
1721
shell: pwsh
1822
env:
1923
ZSTD_VERSION: ${{ inputs.version }}
24+
ZSTD_CHECKSUM: ${{ inputs.checksum }}
2025
run: |
2126
$url = "https://github.com/facebook/zstd/releases/download/v$env:ZSTD_VERSION/zstd-v$env:ZSTD_VERSION-win64.zip"
2227
$installDir = "$env:RUNNER_TOOL_CACHE\zstd-v$env:ZSTD_VERSION-win64"
2328
Invoke-WebRequest -OutFile "$env:TEMP\zstd.zip" -Uri $url
29+
$checksum = (Get-FileHash "$env:TEMP\zstd.zip" -Algorithm SHA256).Hash.ToLower()
30+
if ($checksum -ne $env:ZSTD_CHECKSUM) {
31+
Write-Error "zstd checksum verification failed. Expected: $env:ZSTD_CHECKSUM, Actual: $checksum"
32+
exit 1
33+
}
2434
Expand-Archive -Path "$env:TEMP\zstd.zip" -DestinationPath $env:RUNNER_TOOL_CACHE -Force
2535
echo "$installDir" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
2636
& "$installDir\zstd.exe" --version

0 commit comments

Comments
 (0)