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"