Skip to content

Add automated validation for JSON schemas #18

Add automated validation for JSON schemas

Add automated validation for JSON schemas #18

name: Validate JSON Schemas
on:
pull_request:
paths:
- '**/theme.json'
- '**/styles/*.json'
- '**/assets/fonts/*.json'
env:
paths: >-
'**/theme.json'
'**/styles/*.json'
'**/assets/fonts/*.json'
jobs:
validate-schemas:
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: Get JSON files list
run: |
git fetch --prune --no-recurse-submodules --depth=1 origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }} &&
echo "PR_MODIFIED_JSON_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.ref }} -- ${{ env.paths }} | tr '\n' ' ')" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Validate JSON files
run: node theme-utils.mjs validate-schema ${{ env.PR_MODIFIED_JSON_FILES }}