Skip to content

Commit

Permalink
Support GitHub API authorization for LuaRocks version query (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
ueisele authored May 31, 2024
1 parent f0f1ed9 commit e3ee020
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ get_download_file_path() {
}

get_latest_luarocks_version() {
curl -sL "https://api.github.com/repos/luarocks/luarocks/tags?per_page=1&page=1" |
curl_opts=(-fsSL)
if [ -n "${GITHUB_API_TOKEN:-}" ]; then
curl_opts=("${curl_opts[@]}" -H "Authorization: token ${GITHUB_API_TOKEN}")
fi
curl "${curl_opts[@]}" "https://api.github.com/repos/luarocks/luarocks/tags?per_page=1&page=1" |
grep '"name"' | cut -d\" -f4 | cut -c2-
}

0 comments on commit e3ee020

Please sign in to comment.