Skip to content

Commit 466041e

Browse files
committed
Add GitHub actions
1 parent c015c9b commit 466041e

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Validate JSON Schemas
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**/theme.json'
7+
- '**/styles/*.json'
8+
- '**/assets/fonts/*.json'
9+
10+
env:
11+
PR_PATHS: >-
12+
'**/theme.json'
13+
'**/styles/*.json'
14+
'**/assets/fonts/*.json'
15+
HUSKY: 0
16+
17+
jobs:
18+
validate-schema:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
repository: ${{ github.event.pull_request.head.repo.full_name }}
26+
ref: ${{ github.event.pull_request.head.ref }}
27+
28+
- name: Fetch compare
29+
run: |
30+
git remote add upstream ${{ github.event.pull_request.base.repo.repositoryUrl }}
31+
git fetch --no-write-fetch-head --depth=1 upstream ${{ github.event.pull_request.base.ref }}
32+
33+
- name: Setup Node
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version-file: '.nvmrc'
37+
cache: 'npm'
38+
39+
- name: Install dependencies
40+
run: npm ci
41+
42+
- name: Validate JSON files
43+
run: node theme-utils.mjs validate-schema $(git diff --name-only upstream/${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.ref }} -- ${{ env.PR_PATHS }} | tr '\n' ' ')

0 commit comments

Comments
 (0)