Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
pull_request:
push:
branches: [main]
# สั่งรันเองได้จากหน้า Actions เวลาอยากเช็คซ้ำโดยไม่ต้อง push อะไร
workflow_dispatch:

permissions:
contents: read
Expand Down
8 changes: 6 additions & 2 deletions scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
set -uo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$(dirname "$SCRIPT_DIR")"
cd "$(dirname "$SCRIPT_DIR")" || exit 1

if [ -t 1 ]; then
GREEN=$'\033[32m'; RED=$'\033[31m'; DIM=$'\033[2m'; RESET=$'\033[0m'
Expand Down Expand Up @@ -135,8 +135,12 @@ check_shell() {
for f in scripts/*.sh; do
if shellcheck -S warning -f gcc "$f"; then ok "$f"; else fail=1; fi
done
elif [ -n "${GITHUB_ACTIONS:-}" ]; then
# ใน CI ต้องมีเสมอ — ถ้าหายไปแปลว่า runner เปลี่ยน อย่าปล่อยผ่านเงียบ ๆ
err "scripts/" "ไม่พบ shellcheck บน runner"
else
echo " ${DIM}(ไม่มี shellcheck บนเครื่องนี้ — ข้าม ติดตั้ง: apt install shellcheck)${RESET}"
printf ' %s(ไม่มี shellcheck บนเครื่องนี้ — ข้ามไปก่อน แต่ CI จะรันให้ ถ้าไม่อยากให้ PR แดง\n' "$DIM"
printf ' ติดตั้งด้วย: sudo apt install shellcheck)%s\n' "$RESET"
fi

head_ "scripts: ต้องรันได้ (mode 100755)"
Expand Down