fix: validate category refs in CI + fix 4 servers with unknown categories #274
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 PR | |
| on: | |
| pull_request: | |
| paths: | |
| - "servers/**" | |
| - "categories.json" | |
| - "schemas/**" | |
| - "scripts/**" | |
| - "tests/**" | |
| jobs: | |
| validate: | |
| name: Validate Server Definitions | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Get changed server files | |
| id: changed | |
| uses: tj-actions/changed-files@v44 | |
| with: | |
| files: "servers/*.json" | |
| - name: Validate changed server files | |
| # Runs schema validation AND category-reference checks via scripts/validate.js. | |
| # A category ID not present in categories.json fails here, since the | |
| # bundler's server_categories table has a FK to categories.id and a | |
| # typo would silently break sync for that server. | |
| run: | | |
| if [ -n "${{ steps.changed.outputs.all_changed_files }}" ]; then | |
| npm run validate -- ${{ steps.changed.outputs.all_changed_files }} | |
| else | |
| echo "No changed server files detected, running full validation as fallback" | |
| npm run validate:all | |
| fi | |
| - name: Check for conflicts | |
| run: npm run check-conflicts | |
| - name: Run full test suite | |
| # Covers cross-file consistency checks (categories.json, bundle build, | |
| # deprecated `icon` field, logo URL format) that per-file validation | |
| # can't express. | |
| run: npm test |