forked from FWS/FWS-TEMPLATE-Website-OnePage
fix(ci): keep packaging files and shebang noise out of the shell scan
This commit is contained in:
1 file changed
+10
-4
@@ -75,26 +75,32 @@ jobs:
|
|||||||
- name: Collect the shell scripts
|
- name: Collect the shell scripts
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
git ls-files -z '*.sh' '*.bash' 'PKGBUILD' > "$RUNNER_TEMP/scripts"
|
# PKGBUILD files are bash without a shebang, so shellcheck would report
|
||||||
|
# SC2148 on every one of them: makepkg sources them, the gate does not.
|
||||||
|
git ls-files -z '*.sh' '*.bash' > "$RUNNER_TEMP/scripts"
|
||||||
printf '%s shell files to check\n' "$(tr -cd '\0' < "$RUNNER_TEMP/scripts" | wc -c)"
|
printf '%s shell files to check\n' "$(tr -cd '\0' < "$RUNNER_TEMP/scripts" | wc -c)"
|
||||||
|
|
||||||
# SC2086/SC2046 and friends are the shapes an injection takes in shell.
|
# SC2086/SC2046 and friends are the shapes an injection takes in shell.
|
||||||
# They stay advisory for now: existing scripts would turn the gate red on
|
# They stay advisory for now: existing scripts would turn the gate red on
|
||||||
# their first run, so warnings are reported and errors block.
|
# their first run, so warnings are reported and errors block. SC2148 (no
|
||||||
|
# shebang) and SC2068 (array quoting, inherited from vendored shell
|
||||||
|
# integrations) are not signals this gate can act on.
|
||||||
- name: Shellcheck warnings (advisory)
|
- name: Shellcheck warnings (advisory)
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
[ -s "$RUNNER_TEMP/scripts" ] || { echo "No shell scripts in this repository."; exit 0; }
|
[ -s "$RUNNER_TEMP/scripts" ] || { echo "No shell scripts in this repository."; exit 0; }
|
||||||
xargs -0 -a "$RUNNER_TEMP/scripts" -r \
|
xargs -0 -a "$RUNNER_TEMP/scripts" -r \
|
||||||
"$RUNNER_TEMP/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" -x --format=gcc --severity=warning
|
"$RUNNER_TEMP/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" -x --format=gcc --severity=warning \
|
||||||
|
--exclude=SC2148,SC2068
|
||||||
|
|
||||||
- name: Shellcheck errors
|
- name: Shellcheck errors
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
[ -s "$RUNNER_TEMP/scripts" ] || { echo "No shell scripts in this repository."; exit 0; }
|
[ -s "$RUNNER_TEMP/scripts" ] || { echo "No shell scripts in this repository."; exit 0; }
|
||||||
xargs -0 -a "$RUNNER_TEMP/scripts" -r \
|
xargs -0 -a "$RUNNER_TEMP/scripts" -r \
|
||||||
"$RUNNER_TEMP/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" -x --severity=error
|
"$RUNNER_TEMP/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" -x --severity=error \
|
||||||
|
--exclude=SC2148,SC2068
|
||||||
|
|
||||||
sast:
|
sast:
|
||||||
name: sast
|
name: sast
|
||||||
|
|||||||
Reference in new issue
Block a user