|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + validate: |
| 11 | + name: Validate skills and structure |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Count skills |
| 17 | + run: | |
| 18 | + TOTAL=$(ls -d skills/*/ 2>/dev/null | wc -l) |
| 19 | + echo "Total skills: $TOTAL" |
| 20 | + ls -d skills/*/ |
| 21 | +
|
| 22 | + - name: Validate skill frontmatter |
| 23 | + run: | |
| 24 | + ERRORS=0 |
| 25 | + for dir in skills/*/; do |
| 26 | + SKILL_FILE=$(find "$dir" -maxdepth 1 -name '*.md' | head -1) |
| 27 | + if [ -z "$SKILL_FILE" ]; then |
| 28 | + echo "::warning::No .md file in $dir" |
| 29 | + continue |
| 30 | + fi |
| 31 | +
|
| 32 | + # Check frontmatter exists |
| 33 | + if ! head -1 "$SKILL_FILE" | grep -q '^---'; then |
| 34 | + echo "::error file=$SKILL_FILE::Missing frontmatter" |
| 35 | + ERRORS=$((ERRORS + 1)) |
| 36 | + continue |
| 37 | + fi |
| 38 | +
|
| 39 | + # Check required fields |
| 40 | + FRONTMATTER=$(sed -n '1,/^---$/p' "$SKILL_FILE" | tail -n +2) |
| 41 | + for field in name description; do |
| 42 | + if ! echo "$FRONTMATTER" | grep -q "^${field}:"; then |
| 43 | + echo "::error file=$SKILL_FILE::Missing required field: $field" |
| 44 | + ERRORS=$((ERRORS + 1)) |
| 45 | + fi |
| 46 | + done |
| 47 | + done |
| 48 | +
|
| 49 | + if [ $ERRORS -gt 0 ]; then |
| 50 | + echo "::error::$ERRORS validation error(s) found" |
| 51 | + exit 1 |
| 52 | + fi |
| 53 | + echo "All skills validated successfully" |
| 54 | +
|
| 55 | + - name: Validate agents |
| 56 | + run: | |
| 57 | + ERRORS=0 |
| 58 | + for file in agents/*.md; do |
| 59 | + [ -f "$file" ] || continue |
| 60 | + if ! head -1 "$file" | grep -q '^---'; then |
| 61 | + echo "::error file=$file::Missing frontmatter" |
| 62 | + ERRORS=$((ERRORS + 1)) |
| 63 | + fi |
| 64 | + done |
| 65 | + exit $ERRORS |
| 66 | +
|
| 67 | + - name: Check package.json |
| 68 | + run: | |
| 69 | + node -e " |
| 70 | + const pkg = JSON.parse(require('fs').readFileSync('package.json', 'utf8')); |
| 71 | + const required = ['name', 'version', 'description', 'license']; |
| 72 | + const missing = required.filter(f => !pkg[f]); |
| 73 | + if (missing.length) { |
| 74 | + console.error('Missing package.json fields:', missing.join(', ')); |
| 75 | + process.exit(1); |
| 76 | + } |
| 77 | + console.log('package.json OK:', pkg.name, 'v' + pkg.version); |
| 78 | + " |
0 commit comments