File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -317,11 +317,14 @@ http_copy() {
317
317
github_release () {
318
318
owner_repo=$1
319
319
version=$2
320
- test -z " $version " && version=" latest"
321
- giturl=" https://github.com/${owner_repo} /releases/${version} "
320
+ if [ -z " $version " ]; then
321
+ giturl=" https://api.github.com/repos/${owner_repo} /releases/latest"
322
+ else
323
+ giturl=" https://api.github.com/repos/${owner_repo} /releases/tags/${version} "
324
+ fi
322
325
json=$( http_copy " $giturl " " Accept:application/json" )
323
326
test -z " $json " && return 1
324
- version=$( echo " $json " | tr -s ' \n' ' ' | sed ' s/.*"tag_name":"//' | sed ' s/".*//' )
327
+ version=$( echo " $json " | tr -s ' \n' ' ' | sed ' s/.*"tag_name": "//' | sed ' s/".*//' )
325
328
test -z " $version " && return 1
326
329
echo " $version "
327
330
}
You can’t perform that action at this time.
0 commit comments