Last active
September 20, 2024 17:15
-
-
Save boredwz/e7872773f4c44671ca37fad7ca3912b7 to your computer and use it in GitHub Desktop.
(PowerShell) Get GitHub latest release URL — attached files, source (zip, tar).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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