mirror of
https://github.com/adobe/skills.git
synced 2026-09-19 08:06:09 +08:00
97 lines
2.9 KiB
YAML
97 lines
2.9 KiB
YAML
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=()
|
|
while IFS= read -r plugin_json; do
|
|
# Extract the directory path from the plugin.json file path
|
|
path="/${plugin_json%/.claude-plugin/plugin.json}"
|
|
echo "Checking $path in CODEOWNERS..."
|
|
if ! grep -q "^${path}[/ ]" "$codeowners"; then
|
|
missing+=("$path")
|
|
fi
|
|
done < <(find plugins -name "plugin.json" -path "*/.claude-plugin/plugin.json")
|
|
|
|
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 plugins -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 plugins -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."
|