@@ -11,6 +11,75 @@ concurrency:
1111 cancel-in-progress : true
1212
1313jobs :
14+ lint :
15+ name : Lint & format
16+ runs-on : ubuntu-latest
17+ steps :
18+ - name : Checkout
19+ uses : actions/checkout@v6
20+
21+ - name : Check for trailing whitespace
22+ run : |
23+ if grep -rn --include='*.md' --include='*.ts' --include='*.tsx' --include='*.astro' --include='*.json' --include='*.yaml' --include='*.yml' --include='*.css' '[[:blank:]]$' .; then
24+ echo "::error::Trailing whitespace found"
25+ exit 1
26+ fi
27+
28+ - name : Check for missing final newline
29+ run : |
30+ bad=0
31+ while IFS= read -r -d '' f; do
32+ if [ -s "$f" ] && [ "$(tail -c1 "$f" | wc -l)" -eq 0 ]; then
33+ echo "::error file=$f::Missing final newline"
34+ bad=1
35+ fi
36+ done < <(find . -type f \( -name '*.md' -o -name '*.ts' -o -name '*.tsx' -o -name '*.astro' -o -name '*.json' -o -name '*.yaml' -o -name '*.yml' -o -name '*.css' \) -not -path './node_modules/*' -not -path './.git/*' -print0)
37+ exit $bad
38+
39+ - name : Validate YAML files
40+ run : |
41+ pip install --quiet yamllint
42+ find . -type f \( -name '*.yaml' -o -name '*.yml' \) -not -path './node_modules/*' -not -path './.git/*' | xargs -r python3 -c "
43+ import sys, yaml
44+ for f in sys.argv[1:]:
45+ try:
46+ yaml.safe_load(open(f))
47+ except Exception as e:
48+ print(f'::error file={f}::{e}')
49+ sys.exit(1)
50+ "
51+
52+ - name : Validate JSON files
53+ run : |
54+ find . -type f -name '*.json' -not -path './node_modules/*' -not -path './.git/*' | xargs -r python3 -c "
55+ import sys, json
56+ for f in sys.argv[1:]:
57+ try:
58+ json.load(open(f))
59+ except Exception as e:
60+ print(f'::error file={f}::{e}')
61+ sys.exit(1)
62+ "
63+
64+ - name : Check for merge conflict markers
65+ run : |
66+ if grep -rn '<<<<<<< \|=======$\|>>>>>>> ' --include='*.md' --include='*.ts' --include='*.tsx' --include='*.astro' --include='*.json' --include='*.yaml' --include='*.yml' --include='*.css' .; then
67+ echo "::error::Merge conflict markers found"
68+ exit 1
69+ fi
70+
71+ - name : Check for large files
72+ run : |
73+ bad=0
74+ while IFS= read -r f; do
75+ size=$(stat --printf='%s' "$f" 2>/dev/null || stat -f'%z' "$f")
76+ if [ "$size" -gt 512000 ]; then
77+ echo "::error file=$f::File is $(( size / 1024 ))KB (max 500KB)"
78+ bad=1
79+ fi
80+ done < <(git diff --cached --name-only --diff-filter=d 2>/dev/null || git ls-files)
81+ exit $bad
82+
1483 quality :
1584 name : Quality checks
1685 runs-on : ubuntu-latest
45114 build :
46115 name : Build
47116 runs-on : ubuntu-latest
48- needs : [quality, spellcheck]
117+ needs : [lint, quality, spellcheck]
49118 steps :
50119 - name : Checkout
51120 uses : actions/checkout@v6
0 commit comments