mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-03-05 14:26:24 +00:00
Updated GH_TOKEN usage (#1688)
This commit is contained in:
@@ -1,5 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
function get_from_gh() {
|
||||
if [[ "${GH_TOKEN:-}" ]]; then
|
||||
# User has provided a Personal Access Token to mitigate rate-limiting issues
|
||||
if [[ -z "${oAuthScopes}" ]]; then
|
||||
oAuthScopes=$(curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/codertocat -I | grep x-oauth-scopes)
|
||||
fi
|
||||
if [[ ! "$oAuthScopes" =~ ^x-oauth-scopes:[[:space:]]*$ ]]; then
|
||||
# Don't use what you don't have to...
|
||||
log "ERROR: GH_TOKEN has permissions it doesn't need. Recreate or update this personal access token and disable ALL scopes."
|
||||
exit 1
|
||||
else
|
||||
echo $(curl -fsSL -H "Authorization: token $GH_TOKEN" ${@:2} $1)
|
||||
fi
|
||||
else
|
||||
echo $(curl -fsSL ${@:2} $1)
|
||||
fi
|
||||
}
|
||||
|
||||
function join_by() {
|
||||
local d=$1
|
||||
shift
|
||||
@@ -291,7 +309,7 @@ function checkSum() {
|
||||
|
||||
# Get distro
|
||||
distro=$(getDistro)
|
||||
|
||||
|
||||
if [ "${distro}" == "debian" ] && sha1sum -c "${sum_file}" --status 2> /dev/null; then
|
||||
return 0
|
||||
elif [ "${distro}" == "ubuntu" ] && sha1sum -c "${sum_file}" --status 2> /dev/null; then
|
||||
|
||||
Reference in New Issue
Block a user