|
| 1 | +name: Validate |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + validate-scripts: |
| 11 | + name: Validate Shell Scripts |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout repository |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Check shell script syntax |
| 19 | + run: | |
| 20 | + echo "Checking shell script syntax..." |
| 21 | + for script in scripts/*.sh bootstrap/*.sh; do |
| 22 | + if [ -f "$script" ]; then |
| 23 | + echo " Checking $script..." |
| 24 | + bash -n "$script" || exit 1 |
| 25 | + fi |
| 26 | + done |
| 27 | + echo "✓ All scripts pass syntax check" |
| 28 | +
|
| 29 | + - name: Run ShellCheck |
| 30 | + uses: ludeeus/action-shellcheck@master |
| 31 | + with: |
| 32 | + scandir: './scripts' |
| 33 | + severity: warning |
| 34 | + continue-on-error: true |
| 35 | + |
| 36 | + validate-templates: |
| 37 | + name: Validate CLAUDE.md Templates |
| 38 | + runs-on: ubuntu-latest |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Checkout repository |
| 42 | + uses: actions/checkout@v4 |
| 43 | + |
| 44 | + - name: Validate templates |
| 45 | + run: | |
| 46 | + chmod +x scripts/validate-templates.sh |
| 47 | + ./scripts/validate-templates.sh |
| 48 | +
|
| 49 | + validate-agents: |
| 50 | + name: Validate Agent Definitions |
| 51 | + runs-on: ubuntu-latest |
| 52 | + |
| 53 | + steps: |
| 54 | + - name: Checkout repository |
| 55 | + uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Check YAML frontmatter |
| 58 | + run: | |
| 59 | + echo "Checking agent YAML frontmatter..." |
| 60 | + for agent in agents/*.md; do |
| 61 | + if [ -f "$agent" ]; then |
| 62 | + echo " Checking $agent..." |
| 63 | + # Check for YAML frontmatter delimiters |
| 64 | + if ! head -1 "$agent" | grep -q "^---$"; then |
| 65 | + echo " ERROR: Missing opening YAML delimiter" |
| 66 | + exit 1 |
| 67 | + fi |
| 68 | + # Check for required fields |
| 69 | + if ! grep -q "^name:" "$agent"; then |
| 70 | + echo " ERROR: Missing 'name' field" |
| 71 | + exit 1 |
| 72 | + fi |
| 73 | + if ! grep -q "^description:" "$agent"; then |
| 74 | + echo " ERROR: Missing 'description' field" |
| 75 | + exit 1 |
| 76 | + fi |
| 77 | + echo " ✓ Valid" |
| 78 | + fi |
| 79 | + done |
| 80 | + echo "✓ All agents have valid frontmatter" |
| 81 | +
|
| 82 | + lint-markdown: |
| 83 | + name: Lint Markdown |
| 84 | + runs-on: ubuntu-latest |
| 85 | + |
| 86 | + steps: |
| 87 | + - name: Checkout repository |
| 88 | + uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - name: Check for placeholder text |
| 91 | + run: | |
| 92 | + echo "Checking for placeholder text..." |
| 93 | + if grep -rn "TODO\|PLACEHOLDER\|lorem ipsum" --include="*.md" \ |
| 94 | + --exclude-dir=templates \ |
| 95 | + --exclude="CLAUDE.md.template" .; then |
| 96 | + echo "" |
| 97 | + echo "WARNING: Found placeholder text in non-template files" |
| 98 | + # Don't fail, just warn |
| 99 | + else |
| 100 | + echo "✓ No placeholder text found" |
| 101 | + fi |
| 102 | +
|
| 103 | + test-scripts: |
| 104 | + name: Run Script Tests |
| 105 | + runs-on: ubuntu-latest |
| 106 | + |
| 107 | + steps: |
| 108 | + - name: Checkout repository |
| 109 | + uses: actions/checkout@v4 |
| 110 | + |
| 111 | + - name: Install bats |
| 112 | + run: | |
| 113 | + sudo apt-get update |
| 114 | + sudo apt-get install -y bats |
| 115 | +
|
| 116 | + - name: Run tests |
| 117 | + run: | |
| 118 | + if [ -d "tests" ] && ls tests/*.bats 1> /dev/null 2>&1; then |
| 119 | + bats tests/*.bats |
| 120 | + else |
| 121 | + echo "No bats tests found, skipping" |
| 122 | + fi |
0 commit comments