Skip to content

Instantly share code, notes, and snippets.

@boredwz
Last active September 20, 2024 17:15
Show Gist options
  • Select an option

  • Save boredwz/e7872773f4c44671ca37fad7ca3912b7 to your computer and use it in GitHub Desktop.

Select an option

Save boredwz/e7872773f4c44671ca37fad7ca3912b7 to your computer and use it in GitHub Desktop.
(PowerShell) Get GitHub latest release URL — attached files, source (zip, tar).
# Get-GithubLatestReleaseURL (PowerShell)
#
# [Author]
# boredwz | https://github.com/boredwz/
#
# [Usage]
# iex "&{$(iwr -useb 'https://gist.githubusercontent.com/boredwz/e7872773f4c44671ca37fad7ca3912b7/raw/Get-GithubLatestReleaseUrl.ps1')} 'author' 'repo'"
# Or download this file:
# & ".\Get-GitHubLatestReleaseURL" author repo
param (
[Parameter(Mandatory=$true)][string]$Author,
[Parameter(Mandatory=$true)][string]$Repo
)
$api = Invoke-RestMethod "https://api.github.com/repos/$Author/$Repo/releases/latest"
return @{
Files=$api.assets.browser_download_url;
Zip=$api.zipball_url;
Tar=$api.tarball_url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment