Description
Expose the repos/$user/$repo/releases api by returning matching releases by optional tag and optionally filtering out the assets results by name. Signature of the method could look very similar to Get-GithubRepositoryTag but with an optional [string[]] TagName, [string] AssetName, [switch] PreRelease parameters.
-
When TagName parameter is provided, results from the releases api will be filtered by matching tag_name entries in the TagName array.
-
When AssetName is provided, filter the releases/tags assets array for names that match using the -like operator.
-
When PreRelease is provided, do not filter the results from releases api. By default, only show releases where prerelease = false.
I currently have a script using the repos/$user/$repo/releases/tags/$tagname api but for some repositories that have changed their tagname pattern over time (such as rabbitmq/rabbitmq-server), this requires me to resort to a multi-level try catch mechanism in trying one tag value first and retrying with the alternate pattern after detecting a 404 response. Filtering the results from /releases/tags client side is less than ideal from a performance perspective compared to using /releases/tags/$tagname but provide a much better end-user experience.
There are also repositories such as microsoft/vsts-agent (now renamed to microsoft/azure-pipelines-agent) which changed its use of release assets over time. Up thru version 2.126.0, each release entry returned multiple assets and each asset provided a direct link to the binary via browser_download_url. After 2.126.0, there is only one asset result which does not directly link to the binary assets. Instead, the browser_download_url links to an assets.json file whose structure I have to parse before I could download the binary assets.