-
Notifications
You must be signed in to change notification settings - Fork 3
168 lines (140 loc) · 5.05 KB
/
validate.yml
File metadata and controls
168 lines (140 loc) · 5.05 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Validate
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
workflow_dispatch:
jobs:
manifest-check:
name: Manifest & Skill Integrity
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Parse manifest.ini
run: |
python3 -c "
import configparser, sys, os
c = configparser.ConfigParser()
c.read('skills/manifest.ini')
if not c.sections():
print('Error: manifest.ini has no skill sections')
sys.exit(1)
errors = []
for skill in c.sections():
for key in ('repo', 'ref', 'path'):
if key not in c[skill]:
errors.append(f'[{skill}] missing required field: {key}')
skill_dir = os.path.join('skills', skill)
if not os.path.isdir(skill_dir):
errors.append(f'[{skill}] local directory not found: {skill_dir}')
if errors:
for e in errors:
print(f'Error: {e}')
sys.exit(1)
print(f'Manifest OK: {len(c.sections())} skill(s) validated')
"
- name: Check skill sync status
run: |
bash scripts/maintenance/sync-skills.sh --check
markdown-lint:
name: Markdown Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run markdownlint
uses: DavidAnson/markdownlint-cli2-action@v19
with:
config: .github/.markdownlint.yaml
globs: |
**/*.md
!skills/**/*.md
!node_modules/**
shellcheck:
name: Shell Script Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
scandir: scripts
severity: warning
file-references:
name: File Reference Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check internal file references
run: |
errors=0
# Check that files referenced in CLAUDE.md exist
# Extract paths like: ├── filename or └── filename patterns are structure, skip those
# Check markdown links to local files: [text](path)
while IFS= read -r file; do
grep -oP '\[.*?\]\((?!https?://|#)([^)]+)\)' "$file" | \
grep -oP '\(([^)]+)\)' | tr -d '()' | while read -r ref; do
# Strip anchor fragments
ref="${ref%%#*}"
[ -z "$ref" ] && continue
# Resolve relative to the file's directory
dir="$(dirname "$file")"
target="$dir/$ref"
if [ ! -e "$target" ]; then
echo "Broken link in $file -> $ref"
errors=$((errors + 1))
fi
done
done < <(find . -name '*.md' -not -path './skills/*' -not -path './.git/*' -not -path './node_modules/*')
# Use a summary file to propagate error count from subshells
# Re-run with error collection
broken=$(find . -name '*.md' -not -path './skills/*' -not -path './.git/*' -not -path './node_modules/*' -exec \
grep -lP '\[.*?\]\((?!https?://|#)([^)]+)\)' {} \; 2>/dev/null | while read -r file; do
grep -oP '\[.*?\]\((?!https?://|#)([^)]+)\)' "$file" | \
grep -oP '\(([^)]+)\)' | tr -d '()' | while read -r ref; do
ref="${ref%%#*}"
[ -z "$ref" ] && continue
dir="$(dirname "$file")"
target="$dir/$ref"
if [ ! -e "$target" ]; then
echo "BROKEN: $file -> $ref"
fi
done
done)
if [ -n "$broken" ]; then
echo "$broken"
echo ""
echo "Found broken file references"
exit 1
else
echo "All file references OK"
fi
validate-summary:
name: Validate Summary
runs-on: ubuntu-latest
needs: [manifest-check, markdown-lint, shellcheck, file-references]
if: always()
steps:
- name: Check results
run: |
echo "Manifest check: ${{ needs.manifest-check.result }}"
echo "Markdown lint: ${{ needs.markdown-lint.result }}"
echo "ShellCheck: ${{ needs.shellcheck.result }}"
echo "File refs: ${{ needs.file-references.result }}"
if [[ "${{ needs.manifest-check.result }}" != "success" ]] || \
[[ "${{ needs.markdown-lint.result }}" != "success" ]] || \
[[ "${{ needs.shellcheck.result }}" != "success" ]] || \
[[ "${{ needs.file-references.result }}" != "success" ]]; then
echo "Some checks failed"
exit 1
else
echo "All checks passed"
fi