|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + lint: |
| 11 | + name: Lint & Validate |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout repository |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Lint Markdown files |
| 19 | + uses: DavidAnson/markdownlint-cli2-action@v14 |
| 20 | + with: |
| 21 | + globs: "**/*.md" |
| 22 | + |
| 23 | + - name: Check spelling |
| 24 | + uses: streetsidesoftware/cspell-action@v5 |
| 25 | + with: |
| 26 | + files: "**/*.md" |
| 27 | + config: "./cspell.json" |
| 28 | + |
| 29 | + - name: Check links |
| 30 | + uses: lycheeverse/lychee-action@v1 |
| 31 | + with: |
| 32 | + args: --verbose --no-progress --exclude-mail './**/*.md' |
| 33 | + fail: true |
| 34 | + |
| 35 | + - name: AISD forbidden words check |
| 36 | + run: | |
| 37 | + echo "Checking for forbidden words (should/might/could/typically/usually/often)..." |
| 38 | + # Exclude README.md, CHANGELOG.md, and AGENTS.md from this check |
| 39 | + if find . -name "*.md" ! -name "README.md" ! -name "CHANGELOG.md" ! -name "AGENTS.md" -exec grep -l -E "\b(should|might|could|typically|usually|often)\b" {} \; | grep -q .; then |
| 40 | + echo "❌ Found forbidden words in the following files:" |
| 41 | + find . -name "*.md" ! -name "README.md" ! -name "CHANGELOG.md" ! -name "AGENTS.md" -exec grep -Hn -E "\b(should|might|could|typically|usually|often)\b" {} \; |
| 42 | + echo "" |
| 43 | + echo "Use MUST/REQUIRED/FORBIDDEN instead per AISD style guide." |
| 44 | + exit 1 |
| 45 | + fi |
| 46 | + echo "✅ No forbidden words found" |
| 47 | +
|
| 48 | + - name: AISD line count check |
| 49 | + run: | |
| 50 | + echo "Checking docs/ files for line count (max 600)..." |
| 51 | + failed=0 |
| 52 | + for file in docs/*.md docs/**/*.md; do |
| 53 | + [ -f "$file" ] || continue |
| 54 | + lines=$(wc -l < "$file") |
| 55 | + if [ "$lines" -gt 600 ]; then |
| 56 | + echo "❌ $file has $lines lines (max 600)" |
| 57 | + failed=1 |
| 58 | + fi |
| 59 | + done |
| 60 | + if [ "$failed" -eq 1 ]; then |
| 61 | + echo "Consider splitting large files." |
| 62 | + exit 1 |
| 63 | + fi |
| 64 | + echo "✅ All docs files within line limit" |
| 65 | +
|
| 66 | + commitlint: |
| 67 | + name: Commit Messages |
| 68 | + runs-on: ubuntu-latest |
| 69 | + if: github.event_name == 'pull_request' |
| 70 | + |
| 71 | + steps: |
| 72 | + - name: Checkout repository |
| 73 | + uses: actions/checkout@v4 |
| 74 | + with: |
| 75 | + fetch-depth: 0 |
| 76 | + |
| 77 | + - name: Setup Node.js |
| 78 | + uses: actions/setup-node@v4 |
| 79 | + with: |
| 80 | + node-version: "20" |
| 81 | + |
| 82 | + - name: Install commitlint |
| 83 | + run: npm install -g @commitlint/cli @commitlint/config-conventional |
| 84 | + |
| 85 | + - name: Validate PR commits |
| 86 | + run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose |
0 commit comments