Skip to content

Commit

Permalink
feat: add setup step
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed May 7, 2024
1 parent 4823355 commit 5b1f542
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Check warning

Code scanning / shellcheck

SC1091 Warning

Not following: setup.sh: openBinaryFile: does not exist (No such file or directory)

WORK_DIR="${WORK_DIR-../}"

Expand Down
12 changes: 12 additions & 0 deletions src/setup.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5b1f542

Please sign in to comment.