Skip to content

How to download latest private GitHub release with PowerShell script? #24683

Answered by sonibla
bmils asked this question in API and Webhooks
Discussion options

You must be logged in to vote

Hello there @bmils

I found a solution !

Simple version (without tag and folder): Download assets from private Github releases using PowerShell · GitHub

Version similar to your script:

# Download latest release from GitHub
$credentials="<github_access_token>"
$repo = "<user_or_org>/<repo_name>"
$file = "<name_of_asset_file>"
$folder="<folder_to_extract_to>"

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "token $credentials")
$releases = "https://api.github.com/repos/$repo/releases"

Write-Host Determining latest release
$id = ((Invoke-WebRequest $releases -Headers $headers | ConvertFrom-Json)[0].assets | where { $_.name -eq $fi…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
1 reply
@sonibla
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment