mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-22 00:31:07 -05:00
Improve GITHUB_API_URL default value handling (#2031)
* Improve GITHUB_API_URL default value handling GitHub Actions [already has](https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables) `GITHUB_API_URL` environment variable which contains GitHub API URL. We should be smart about overriding it and, if it exist and already has value, we should not override it. * Strip slash from GITHUB_API_URL * Update linter.sh * Update linter.sh * make shfmt happy Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
This commit is contained in:
parent
572f93466a
commit
192b06392a
1 changed files with 13 additions and 5 deletions
|
@ -64,12 +64,20 @@ source /action/lib/functions/worker.sh # Source the function script(s)
|
|||
###########
|
||||
# GLOBALS #
|
||||
###########
|
||||
# GitHub API root url
|
||||
if [ -n "$GITHUB_CUSTOM_API_URL" ]; then
|
||||
GITHUB_API_URL="${GITHUB_CUSTOM_API_URL}"
|
||||
elif [ -z "$GITHUB_API_URL" ]; then
|
||||
GITHUB_API_URL="https://api.github.com"
|
||||
fi
|
||||
# Remove trailing slash if present
|
||||
GITHUB_API_URL="${GITHUB_API_URL%/}"
|
||||
|
||||
# Default Vars
|
||||
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
|
||||
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter rules directory
|
||||
GITHUB_API_URL="${GITHUB_CUSTOM_API_URL:-"https://api.github.com"}" # GitHub API root url
|
||||
VERSION_FILE='/action/lib/functions/linterVersions.txt' # File to store linter versions
|
||||
export VERSION_FILE # Workaround SC2034
|
||||
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
|
||||
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter rules directory
|
||||
VERSION_FILE='/action/lib/functions/linterVersions.txt' # File to store linter versions
|
||||
export VERSION_FILE # Workaround SC2034
|
||||
|
||||
###############
|
||||
# Rules files #
|
||||
|
|
Loading…
Reference in a new issue