-
Notifications
You must be signed in to change notification settings - Fork 15
95 lines (78 loc) · 2.67 KB
/
validate.yml
File metadata and controls
95 lines (78 loc) · 2.67 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
name: Validate Skills
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- run: npm ci
- run: npm run validate
codeowners-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check CODEOWNERS covers all skill directories
run: |
codeowners=".github/CODEOWNERS"
if [ ! -f "$codeowners" ]; then
echo "::error::CODEOWNERS file not found at $codeowners"
exit 1
fi
missing=()
for dir in skills/*/*/; do
# Remove trailing slash for the lookup path
path="/${dir%/}"
if ! grep -q "^${path}[/ ]" "$codeowners"; then
missing+=("$path")
fi
done
if [ ${#missing[@]} -gt 0 ]; then
echo "::error::The following skill directories are not covered in CODEOWNERS:"
for p in "${missing[@]}"; do
echo " $p"
done
exit 1
fi
echo "All skill directories are covered in CODEOWNERS."
license-field:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check SKILL.md files have license field in frontmatter
run: |
missing=()
for file in $(find skills -name SKILL.md); do
# Extract frontmatter (between first two --- delimiters) and check for license field
if ! awk '/^---$/{n++; next} n==1{print} n>=2{exit}' "$file" | grep -q "^license:"; then
missing+=("$file")
fi
done
# Write GitHub Step Summary
echo "## License Field Check" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Skill | Status |" >> "$GITHUB_STEP_SUMMARY"
echo "|-------|--------|" >> "$GITHUB_STEP_SUMMARY"
for file in $(find skills -name SKILL.md | sort); do
if printf '%s\n' "${missing[@]}" | grep -qx "$file"; then
echo "| $file | ❌ Missing |" >> "$GITHUB_STEP_SUMMARY"
else
echo "| $file | ✅ Pass |" >> "$GITHUB_STEP_SUMMARY"
fi
done
if [ ${#missing[@]} -gt 0 ]; then
echo ""
echo "::error::The following SKILL.md files are missing a 'license:' field in their frontmatter:"
for f in "${missing[@]}"; do
echo " $f"
done
exit 1
fi
echo "All SKILL.md files have a license field."