schema-fix #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Validate Specs | |
| on: | |
| pull_request: | |
| paths: | |
| - "specs/**/*.spec.md" | |
| - "packages/validate-specs/**" | |
| - ".github/workflows/validate-specs.yml" | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - "specs/**/*.spec.md" | |
| - "packages/validate-specs/**" | |
| - ".github/workflows/validate-specs.yml" | |
| jobs: | |
| validate-specs: | |
| name: Validate Specs | |
| runs-on: self-hosted | |
| permissions: | |
| contents: read | |
| env: | |
| DIAL_KEY: ${{ secrets.DIAL_KEY }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Setup bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: latest | |
| - name: Ensure jq is available | |
| run: | | |
| if ! command -v jq >/dev/null 2>&1; then | |
| sudo apt-get update | |
| sudo apt-get install -y jq | |
| fi | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Run specs validation | |
| run: | | |
| mkdir -p .specs-validation | |
| touch .specs-validation/result.json | |
| bun run validate-specs > .specs-validation/result.json | |
| - name: Parse validation result | |
| id: validation | |
| run: | | |
| RESULT=$(jq -r '.result' .specs-validation/result.json) | |
| INVALID_COUNT=$(jq '[.violations[] | select(.severity=="INVALID")] | length' .specs-validation/result.json) | |
| CONDITIONAL_COUNT=$(jq '[.violations[] | select(.severity=="CONDITIONAL")] | length' .specs-validation/result.json) | |
| echo "result=$RESULT" >> "$GITHUB_OUTPUT" | |
| echo "invalid_count=$INVALID_COUNT" >> "$GITHUB_OUTPUT" | |
| echo "conditional_count=$CONDITIONAL_COUNT" >> "$GITHUB_OUTPUT" | |
| - name: Render validation summary | |
| if: always() | |
| run: | | |
| { | |
| echo "# 📋 Specs Validation Result" | |
| echo "" | |
| echo "| Metric | Value |" | |
| echo "|-------|-------|" | |
| echo "| Result | **${{ steps.validation.outputs.result }}** |" | |
| echo "| Critical violations | ${{ steps.validation.outputs.invalid_count }} |" | |
| echo "| Conditional violations | ${{ steps.validation.outputs.conditional_count }} |" | |
| echo "" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Render validation violations | |
| if: steps.validation.outputs.result != 'VALID' | |
| run: | | |
| echo "## ❌ Violations" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo "| Spec | Rule | Severity | Description |" >> "$GITHUB_STEP_SUMMARY" | |
| echo "|------|------|----------|-------------|" >> "$GITHUB_STEP_SUMMARY" | |
| jq -r '.violations[] | | |
| "| \(.spec_id // "global") | \(.rule) | **\(.severity)** | \(.description) |" | |
| ' .specs-validation/result.json >> "$GITHUB_STEP_SUMMARY" | |
| - name: Initiate spec fix pipeline | |
| # if: steps.validation.outputs.result == 'INVALID' | |
| uses: ./.github/workflows/fix-specs.yml | |
| with: | |
| summary: $GITHUB_STEP_SUMMARY | |
| - name: Fail pipeline on failed validation | |
| if: steps.validation.outputs.result == 'INVALID' | |
| run: | | |
| echo "❌ Specs validation failed" | |
| exit 1 |