-
Notifications
You must be signed in to change notification settings - Fork 33
42 lines (34 loc) · 1.48 KB
/
validate-schemas.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Validate Schemas
on:
pull_request:
paths:
- '**/theme.json'
- '**/style/*.json'
- '**/assets/fonts/*.json'
jobs:
validate-schemas:
runs-on: ubuntu-latest
steps:
- name: 'Get PR commit count'
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
- name: 'Get modified files'
run: |
git fetch origin ${{ github.event.pull_request.base.ref }}
echo "PR_MODIFIED_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.ref }} -- '**/theme.json' '**/styles/*.json' '**/assets/fonts/*.json' | tr '\n' ' ')" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: './package-lock.json'
- name: Install dependencies
run: npm ci
- name: Validate changed schemas
run: |
node theme-utils.mjs validate-schema ${{ env.PR_MODIFIED_FILES}}