Files
shellcheck/entrypoint.sh
T
bot e2cf1982c1
ci / test (push) Failing after 4s
初始版本
2026-11-05 03:16:36 +00:00

14 lines
616 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 用法:entrypoint.sh <files> <severity>;files 是空白分隔的路徑或萬用字元(相對於 workspace),沒有符合的檔案就略過
set -euo pipefail
cd "${GITHUB_WORKSPACE:-$PWD}"
shopt -s nullglob globstar
# shellcheck disable=SC2206 # 依空白拆開,並由 shell 展開萬用字元(不符合的萬用字元展開成空)
files=(${1:-*.sh})
if [ ${#files[@]} -eq 0 ]; then
echo "沒有符合「${1:-*.sh}」的檔案,略過 shellcheck"
exit 0
fi
echo "shellcheck(嚴重度 ${2:-warning} 以上):${files[*]}"
exec shellcheck -x -S "${2:-warning}" "${files[@]}"