Research-Stack/4-Infrastructure/servo-fetch/.github/workflows/skills.yml

54 lines
1.5 KiB
YAML

name: Validate Skills
on:
push:
branches: [main]
paths: ['skills/**']
pull_request:
paths: ['skills/**']
permissions:
contents: read
concurrency:
group: skills-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
name: Validate SKILL.md
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Lint Markdown
uses: DavidAnson/markdownlint-cli2-action@ce4853d43830c74c1753b39f3cf40f71c2031eb9 # v23.0.0
with:
globs: 'skills/**/*.md'
- name: Validate frontmatter and size
run: |
for skill_dir in skills/*/; do
skill_file="${skill_dir}SKILL.md"
if [ ! -f "$skill_file" ]; then
echo "::error::Missing SKILL.md in ${skill_dir}"
exit 1
fi
if ! head -20 "$skill_file" | grep -q '^name:'; then
echo "::error::${skill_file} missing 'name' in frontmatter"
exit 1
fi
if ! head -20 "$skill_file" | grep -q '^description:'; then
echo "::error::${skill_file} missing 'description' in frontmatter"
exit 1
fi
lines=$(wc -l < "$skill_file")
echo "${skill_file}: ${lines} lines"
if [ "$lines" -gt 500 ]; then
echo "::error::${skill_file} exceeds 500 lines (${lines})"
exit 1
fi
done