Skip to content

Commit

Permalink
Execute test: Replace with actual shell code
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmachos committed May 4, 2024
1 parent 09d837d commit 6b9d903
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/Shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,32 @@ jobs:
- name: Execute test
env:
TERM: xterm-256color
PATH: "$PATH:${{ github.workspace }}/shellcheck"
run: ./test

run: |
declare -a ERRORS
declare -a FILES
for file in "${FILES[@]}"; do
if /usr/bin/file "${file}" | /usr/bin/grep --quiet "shell" || \
/usr/bin/file "${file}" | /usr/bin/grep --quiet "bash" || \
/usr/bin/file "${file}" | /usr/bin/grep --quiet "zsh"; then
if shellcheck --shell=bash "${shell_file}" ; then
echo "[PASS] $(/usr/bin/basename "${shell_file}")"
else
echo "[FAIL] $(/usr/bin/basename "${shell_file}")"
ERRORS+=("${shell_file}")
fi
fi
done
if [[ ${#ERRORS[@]} -eq 0 ]]; then
# If ERRORS empty then
echo "[PASS] No errors, hooray"
exit 0
else
# If ERRORS not empty, print the names of files which failed
echo "[FAIL] These files failed linting: ${ERRORS[*]}"
exit 1
fi

0 comments on commit 6b9d903

Please sign in to comment.