mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-10 02:53:36 -05:00
5224656969
Pushes inline scripts in the Dockerfile into standalone scripts and authenticates requests to GitHub using a Personal Access Token to reduce build flakiness due to GitHub's abuse and ratelimiting due to unauthenticated reuests. Signed-off-by: Brett Logan <lindluni@github.com>
21 lines
991 B
Bash
Executable file
21 lines
991 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
# Reference: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7
|
|
# Slightly modified to always retrieve latest stable Powershell version
|
|
# If changing PWSH_VERSION='latest' to a specific version, use format PWSH_VERSION='tags/v7.0.2'
|
|
|
|
mkdir -p "${PWSH_DIRECTORY}"
|
|
url=$(curl -s \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
|
|
"https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION}" |
|
|
jq -r '.assets | .[] | select(.name | contains("linux-alpine-x64")) | .url')
|
|
curl --retry 5 --retry-delay 5 -sL \
|
|
-H "Accept: application/octet-stream" \
|
|
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
|
|
"${url}" | tar -xz -C "${PWSH_DIRECTORY}"
|
|
chmod +x "${PWSH_DIRECTORY}/pwsh"
|
|
ln -sf "${PWSH_DIRECTORY}/pwsh" /usr/bin/pwsh
|
|
pwsh -c "Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force"
|