mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-18 02:32:10 -05:00
23 lines
687 B
Bash
Executable file
23 lines
687 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
KTLINT_VERSION="$(
|
|
set -euo pipefail
|
|
awk -F "[:']" '/ktlint/ {print $4}' "ktlint/build.gradle"
|
|
)"
|
|
echo "Installing Ktlint: ${KTLINT_VERSION}"
|
|
|
|
url=$(
|
|
set -euo pipefail
|
|
curl -s \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
|
|
"https://api.github.com/repos/pinterest/ktlint/releases/tags/${KTLINT_VERSION}" |
|
|
jq -r '.assets | .[] | select(.name=="ktlint") | .url'
|
|
)
|
|
curl --retry 5 --retry-delay 5 -sL -o "/usr/bin/ktlint" \
|
|
-H "Accept: application/octet-stream" \
|
|
-H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
|
|
"${url}"
|
|
chmod a+x /usr/bin/ktlint
|