Add automated validation for JSON schemas #25
This file contains 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 JSON Schemas | |
on: | |
pull_request: | |
paths: | |
- '**/theme.json' | |
- '**/styles/*.json' | |
- '**/assets/fonts/*.json' | |
env: | |
PR_PATHS: >- | |
'**/theme.json' | |
'**/styles/*.json' | |
'**/assets/fonts/*.json' | |
HUSKY: 0 | |
jobs: | |
validate-schema: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Fetch compare | |
run: git fetch --no-write-fetch-head --depth=1 origin ${{ github.event.pull_request.base.ref }} | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Validate JSON files | |
run: node theme-utils.mjs validate-schema $(git diff --name-only origin/${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.ref }} -- ${{ env.PR_PATHS }} | tr '\n' ' ') |