mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 12:48:18 +00:00
* Use Resolve-GithubReleaseAssetUrl more widely * Add the Get-ChecksumFromUrl function * Sort exported functions and add docs * Remove alias and fix typo * Fix kind checksum url and syntax * Fix checksums url for gh cli and msys2 * [Windows] Cleanup various scripts * Add spaces after type specifications * Rename the Take-Part function
29 lines
931 B
PowerShell
29 lines
931 B
PowerShell
################################################################################
|
|
## File: Install-GitHub-CLI.ps1
|
|
## Desc: Install GitHub CLI
|
|
## Supply chain security: GitHub CLI - checksum validation
|
|
################################################################################
|
|
|
|
Write-Host "Get the latest gh version..."
|
|
|
|
$downloadUrl = Resolve-GithubReleaseAssetUrl `
|
|
-Repo "cli/cli" `
|
|
-Version "latest" `
|
|
-UrlMatchPattern "gh_*_windows_amd64.msi"
|
|
|
|
$checksumsUrl = Resolve-GithubReleaseAssetUrl `
|
|
-Repo "cli/cli" `
|
|
-Version "latest" `
|
|
-UrlMatchPattern "gh_*_checksums.txt"
|
|
$externalHash = Get-ChecksumFromUrl -Type "SHA256" `
|
|
-Url $checksumsUrl `
|
|
-FileName (Split-Path $downloadUrl -Leaf)
|
|
|
|
Install-Binary `
|
|
-Url $downloadUrl `
|
|
-ExpectedSHA256Sum $externalHash
|
|
|
|
Add-MachinePathItem "C:\Program Files (x86)\GitHub CLI"
|
|
|
|
Invoke-PesterTests -TestFile "CLI.Tools" -TestName "GitHub CLI"
|