Skip to content

Commit

Permalink
fix: gh-r retrieves release data GH REST API (zdharma-continuum#373)
Browse files Browse the repository at this point in the history
Recent changes to GitHub HTML structure broke `gh-r` & `bpick` ices method of parsing project release assets.

- `gh-r` utilizes official GitHub REST API to retrieve project releases data
- add `local` scope to `releases_url` variable

# closes zdharma-continuum#374 

Co-authored-by: Tyler Wardhaugh <tyler.wardhaugh@gmail.com>
  • Loading branch information
yutkat and tylerw authored Sep 18, 2022
1 parent 8ed4e96 commit 4a2a120
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions zinit-install.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,13 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {

(
if [[ $site = */releases ]] {
local url=$site/${ICE[ver]}
local tag_version=${ICE[ver]}
if [[ -z $tag_version ]]; then
tag_version="$( { .zinit-download-file-stdout $site/latest || .zinit-download-file-stdout $site/latest 1; } 2>/dev/null | \
command grep -m1 -o 'href=./'$user'/'$plugin'/releases/tag/[^"]\+')"
tag_version=${tag_version##*/}
fi
local url=$site/expanded_assets/$tag_version

.zinit-get-latest-gh-r-url-part "$user" "$plugin" "$url" || return $?

Expand Down Expand Up @@ -1456,7 +1462,14 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
local user=$1 plugin=$2 urlpart=$3

if [[ -z $urlpart ]] {
local url=https://github.com/$user/$plugin/releases/$ICE[ver]
local tag_version=${ICE[ver]}
if [[ -z $tag_version ]]; then
local releases_url=https://github.com/$user/$plugin/releases/latest
tag_version="$( { .zinit-download-file-stdout $releases_url || .zinit-download-file-stdout $releases_url 1; } 2>/dev/null | \
command grep -m1 -o 'href=./'$user'/'$plugin'/releases/tag/[^"]\+')"
tag_version=${tag_version##*/}
fi
local url=https://github.com/$user/$plugin/releases/expanded_assets/$tag_version
} else {
local url=https://$urlpart
}
Expand Down

0 comments on commit 4a2a120

Please sign in to comment.