adds simple validation for docs.json and broken links #3
Workflow file for this run
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: Mintlify Documentation Checks | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - '**.mdx' | |
| - '**.md' | |
| - 'docs.json' | |
| - '**.yaml' | |
| - '**.yml' | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| validate-docs-json: | |
| name: Validate docs.json | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Validate docs.json against Mintlify schema | |
| run: | | |
| # Install ajv-cli for JSON schema validation | |
| npm install -g ajv-cli ajv-formats | |
| # Download Mintlify schema | |
| curl -o mintlify-schema.json https://leaves.mintlify.com/schema/docs.json | |
| # Fix the broken regex patterns in the schema using | as delimiter | |
| # The schema has invalid escapes for colons and periods in regex patterns | |
| sed -i 's|\\\\:|:|g' mintlify-schema.json | |
| sed -i 's|\\\\\.|\\.|g' mintlify-schema.json | |
| # Also fix the specific osano.com regex that's causing issues | |
| sed -i 's|"pattern":"\\^https\\\\:\\\\\\/\\\\\\/cmp\\\\.osano\\\\.com\\\\\\/"|"pattern":"^https://cmp\\.osano\\.com/"|' mintlify-schema.json | |
| # Validate docs.json | |
| echo "Validating docs.json against Mintlify schema..." | |
| if ajv validate -s mintlify-schema.json -d docs.json --strict=false --all-errors; then | |
| echo "docs.json valid - OK!" | |
| else | |
| echo "docs.json invalid" | |
| echo "" | |
| echo "Common issues to check:" | |
| echo "- theme must be one of: mint, maple, palm, willow, linden, almond, aspen" | |
| echo "- navigation structure must follow the schema" | |
| echo "- colors must be valid hex codes" | |
| echo "- all page references must be strings" | |
| exit 1 | |
| fi | |
| broken-links: | |
| name: Check Broken Links | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Install Mintlify CLI | |
| run: npm install -g mint | |
| - name: Check for broken links | |
| run: mint broken-links |