mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 07:36:38 -04:00
fix: impl gh-r version detection using GitHub API (#731)
This commit is contained in:
parent
c6dd2a69c5
commit
f1e503dc3b
|
|
@ -1441,9 +1441,15 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
|||
parts=(${(@s:;:)$(.zi::get-architecture)})
|
||||
if [[ -z $urlpart ]]; then
|
||||
local tag_version=${ICE[ver]}
|
||||
if [[ -z $tag_version ]]; then
|
||||
# Try GitHub API first, fallback to HTML parsing
|
||||
local api_url=https://api.github.com/repos/$user/$plugin/releases/latest
|
||||
tag_version="$( { .zinit-download-file-stdout $api_url || .zinit-download-file-stdout $api_url 1; } 2>/dev/null | command grep -o '"tag_name"[[:space:]]*:[[:space:]]*"[^"]\+"' | command grep -o '"[^"]*"$' | tr -d '"' )"
|
||||
# Fallback to original method if API fails
|
||||
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/[^"]\+' )"
|
||||
fi
|
||||
tag_version=${tag_version##*/}
|
||||
fi
|
||||
local url=https://github.com/$user/$plugin/releases/expanded_assets/$tag_version
|
||||
|
|
|
|||
Loading…
Reference in a new issue