Fix wrong interpolation of github auth token.

Thanks to @jamezilla for noticing this.
This commit is contained in:
Matyáš Kříž 2019-05-14 17:41:00 +02:00
parent 083a6b5c17
commit 935afbfd6a
1 changed files with 3 additions and 6 deletions

9
run
View File

@ -7,14 +7,11 @@ GREP_OPTIONS=""
function perform_curl {
if [[ ! -z "$GITHUB_ACCESS_TOKEN" ]]; then
REQUEST_HEADER="-H 'Authorization: token ${GITHUB_ACCESS_TOKEN}'"
echo "$REQUEST_HEADER"
CURL_OPTIONS=(-H "Authorization: token $GITHUB_ACCESS_TOKEN")
fi
echo "$1"
DOWNLOAD_URL=$(curl "$REQUEST_HEADER" "$1" | grep -oe '"browser_download_url":\s*"[^" ]*"' | grep -oe 'http[^" ]*' | grep "$FILE_NAME" | head -1)
echo "$DOWNLOAD_URL"
curl "$REQUEST_HEADER" -Lo "$FILE_NAME" "$DOWNLOAD_URL"
DOWNLOAD_URL=$(curl "${CURL_OPTIONS[@]}" "$1" | grep -oe '"browser_download_url":\s*"[^" ]*"' | grep -oe 'http[^" ]*' | grep "$FILE_NAME" | head -1)
curl "${CURL_OPTIONS[@]}" -Lo "$FILE_NAME" "$DOWNLOAD_URL"
}
function download_generator {