From 09a76dc83950933636e719f34aca64e0c36e8508 Mon Sep 17 00:00:00 2001 From: Kevin Lundberg Date: Tue, 27 Aug 2019 17:45:51 -0400 Subject: [PATCH] use simpler way to get download for a specific version --- bin/install | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/bin/install b/bin/install index f5e7bda..2080cee 100755 --- a/bin/install +++ b/bin/install @@ -2,27 +2,13 @@ set -eo pipefail -BASE_URL="https://api.github.com/repos/realm/swiftlint" -RELEASES_URL="$BASE_URL/releases" +DOWNLOAD_URL="https://github.com/realm/SwiftLint/releases/download/$ASDF_INSTALL_VERSION/portable_swiftlint.zip" -curl_github() { - if [ -n "$GITHUB_API_TOKEN" ]; then - curl -s -H "Authorization: token $GITHUB_API_TOKEN" "$@" - else - curl -s "$@" - fi -} - -# shellcheck source=../lib/utils.sh -source "$(dirname "$0")/../lib/utils.sh" - -download_jq_if_needed - -# Get the url to download the portable swiftlint release -DOWNLOAD_URL="$( - curl_github $RELEASES_URL \ - | $(jq_path) --raw-output ".[] | select(.tag_name == \"$ASDF_INSTALL_VERSION\").assets [] | select(.name == \"portable_swiftlint.zip\").browser_download_url" - )" +curl_cmd="curl -s" +if [ -n "$GITHUB_API_TOKEN" ]; then + curl_cmd="$curl_cmd -H \"Authorization: token $GITHUB_API_TOKEN\"" +fi +curl_cmd="$curl_cmd $DESIRED_RELEASE_URL" # Download the zipped swiftlint file mkdir -p "$ASDF_INSTALL_PATH/bin"