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() {
317317github_release () {
318318 owner_repo=$1
319319 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
322325 json=$( http_copy " $giturl " " Accept:application/json" )
323326 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/".*//' )
325328 test -z " $version " && return 1
326329 echo " $version "
327330}
You can’t perform that action at this time.
0 commit comments