From 94abcab8302441fa6ca9353de5e41b5dd0346b38 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 8 Oct 2024 16:55:06 +0200 Subject: [PATCH] gh/scripts/download-gh-asset.sh: use $GITHUB_TOKEN Use $GITHUB_TOKEN if provided (it is in the CI) to get around API rate limiting (it already is used by the curl calls made by fetch_json function). --- .github/scripts/download-gh-asset.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/scripts/download-gh-asset.sh b/.github/scripts/download-gh-asset.sh index c640c41ab..c82e3b42c 100755 --- a/.github/scripts/download-gh-asset.sh +++ b/.github/scripts/download-gh-asset.sh @@ -21,5 +21,10 @@ gh_path_json=$(fetch_json "$gh_release" "${GITHUB_TOKEN-}" array) gh_path=$(jq -r '[.[] | select(.name | test(".*'"$pattern"'.*"))] | .[0].browser_download_url' "$gh_path_json") rm -- "$gh_path_json" -curl -sSL "$gh_path" -o "$file" +if [ -n "${GITHUB_TOKEN-}" ]; then + set -- -H "Authorization: token $GITHUB_TOKEN" +else + set -- +fi +curl -sSL "$@" "$gh_path" -o "$file"