-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (99 loc) · 3.28 KB
/
Copy pathvalidate.yml
File metadata and controls
111 lines (99 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Validate
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: LICENSE exists
run: test -s LICENSE || (echo "::error::LICENSE missing or empty" && exit 1)
- name: CHANGELOG.md exists
run: test -s CHANGELOG.md || (echo "::error::CHANGELOG.md missing or empty" && exit 1)
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Python compile check
run: |
set -e
fail=0
for f in $(git ls-files '*.py'); do
if ! python -m py_compile "$f"; then
echo "::error file=$f::python compile error"
fail=1
fi
done
exit $fail
- name: Bash syntax check on .sh files
run: |
set -e
fail=0
for f in $(git ls-files '*.sh'); do
if ! bash -n "$f"; then
echo "::error file=$f::bash syntax error"
fail=1
fi
done
exit $fail
- name: ShellCheck (error severity)
# Severity 'error' only — style warnings (SC1090, SC2034, SC2155 etc.)
# are not gated here; track them separately if desired.
uses: ludeeus/action-shellcheck@master
with:
severity: error
scandir: '.'
- name: Every command file has a heading and a parameter section
run: |
set -e
fail=0
for f in $(git ls-files 'commands/*.md'); do
if ! head -5 "$f" | grep -qE '^# /'; then
echo "::error file=$f::missing '# /command' heading on first line"
fail=1
fi
done
exit $fail
- name: SVG files are well-formed XML
run: |
set -e
fail=0
for f in $(git ls-files 'docs/*.svg' '*.svg'); do
if ! python -c "import xml.etree.ElementTree as ET; ET.parse('$f')" 2>/dev/null; then
echo "::error file=$f::malformed SVG XML"
fail=1
fi
done
exit $fail
- name: All docs/* assets referenced from README exist
run: |
set -e
fail=0
for ref in $(grep -hoE 'docs/[a-zA-Z0-9_/-]+\.(svg|png|jpg|jpeg|gif)' README.md README.ru.md | sort -u); do
if [ ! -f "$ref" ]; then
echo "::error file=README.md::missing referenced asset $ref"
fail=1
fi
done
exit $fail
- name: Internal Markdown links resolve
run: |
set -e
fail=0
for src in README.md README.ru.md CHANGELOG.md CONTRIBUTING.md CLAUDE.md; do
[ -f "$src" ] || continue
base="$(dirname "$src")"
for tgt in $(grep -hoE '\]\([^)]+\)' "$src" | sed 's/](\(.*\))/\1/' | sed 's/#.*$//'); do
case "$tgt" in
http*|mailto:*|"") continue ;;
esac
[ "$base" = "." ] && resolved="$tgt" || resolved="$base/$tgt"
if [ ! -e "$resolved" ] && [ ! -e "$tgt" ]; then
echo "::error file=$src::broken internal link → $tgt"
fail=1
fi
done
done
exit $fail