diff --git a/src/functions.sh b/src/functions.sh index 4adb615..e8f0429 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -300,6 +300,8 @@ is_debug () { } # Function to check if the script is run in GitHub Actions environment +# GITHUB_ACTIONS is set when Differential ShellCheck is running in GitHub Actions +# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables is_github_actions () { if [[ -z "${GITHUB_ACTIONS}" ]]; then return 1 diff --git a/src/index.sh b/src/index.sh index 7d5db3d..307f4df 100755 --- a/src/index.sh +++ b/src/index.sh @@ -5,6 +5,8 @@ CURRENT_DIR="$(dirname "$(readlink -f "$0")")" # shellcheck source=functions.sh . "${SCRIPT_DIR="${CURRENT_DIR}/"}functions.sh" +# shellcheck source=setup.sh +. "${SCRIPT_DIR=}setup.sh" WORK_DIR="${WORK_DIR-../}" diff --git a/src/setup.sh b/src/setup.sh new file mode 100644 index 0000000..6ce062f --- /dev/null +++ b/src/setup.sh @@ -0,0 +1,12 @@ +# shellcheck shell=bash + +# TODO set up required variables + +# Set required variables based on the environment +if is_github_actions; then + is_debug && echo "Running in GitHub Actions" +else + is_debug && \ + echo "Running in non GitHub Actions environment" && \ + echo "Functionality is limited" +fi