diff --git a/docs/site/content/docs/assets/cli-install-linux.md b/docs/site/content/docs/assets/cli-install-linux.md index e0098634c6..e7061be0da 100644 --- a/docs/site/content/docs/assets/cli-install-linux.md +++ b/docs/site/content/docs/assets/cli-install-linux.md @@ -31,8 +31,7 @@ 1. _[Alternative]_ Download the release using the CLI. You may download a release using the provided remote script piped into bash. ```sh - curl -H "Authorization: token ${GITHUB_TOKEN}" \ - -H "Accept: application/vnd.github.v3.raw" \ + curl -H "Accept: application/vnd.github.v3.raw" \ -L https://api.github.com/repos/vmware-tanzu/community-edition/contents/hack/get-tce-release.sh | \ bash -s ``` diff --git a/hack/get-tce-release.sh b/hack/get-tce-release.sh index 88e36bfeb6..e273cc2267 100755 --- a/hack/get-tce-release.sh +++ b/hack/get-tce-release.sh @@ -11,12 +11,6 @@ set -e # Script to download asset file from tag release using GitHub API v3. # Inspired by: http://stackoverflow.com/a/35688093/55075 -# Validate GitHub access token -if [ -z "$GITHUB_TOKEN" ]; then - echo "Error: Please define GITHUB_TOKEN variable!" - exit 1 -fi - # Should have two arguments, release-tag and file name if [ $# -ne 2 ]; then echo "Usage: $0 [tag] [name]" @@ -35,11 +29,16 @@ name=$2 GH_API="https://api.github.com" GH_REPO="$GH_API/repos/vmware-tanzu/community-edition" GH_TAGS="$GH_REPO/releases/tags/$tag" -AUTH="Authorization: token $GITHUB_TOKEN" +AUTH="" CURL_ARGS="-LJO#" -# Validate GH token. -curl -o /dev/null -sH "$AUTH" $GH_REPO || { echo "Error: Unauthenticated token or network issue!"; exit 1; } +# Validate GitHub access token +if [ -z "${GITHUB_TOKEN:-}" ]; then + echo "Warning: No GITHUB_TOKEN variable defined - requests to the GitHub API may be rate limited" +else + AUTH="Authorization: token $GITHUB_TOKEN" + curl -o /dev/null -sH "$AUTH" $GH_REPO || { echo "Error: Unauthenticated token or network issue!"; exit 1; } +fi # Read asset tags assets=$(curl -sH "$AUTH" "$GH_TAGS") @@ -65,5 +64,5 @@ GH_ASSET="$GH_REPO/releases/assets/$id" # Download asset file echo "Downloading asset ..." -curl $CURL_ARGS -H "Authorization: token $GITHUB_TOKEN" -H 'Accept: application/octet-stream' "$GH_ASSET" +curl $CURL_ARGS -H "$AUTH" -H "Accept: application/octet-stream" "$GH_ASSET"