Skip to content

Commit e3ee020

Browse files
authored
Support GitHub API authorization for LuaRocks version query (#37)
1 parent f0f1ed9 commit e3ee020

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/utils.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ get_download_file_path() {
7171
}
7272

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

0 commit comments

Comments
 (0)