Skip to content

Commit 7474545

Browse files
committed
chore: Add CI setup for JSON linting
1 parent 3ed2219 commit 7474545

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/json-lint.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Lint JSON
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches-ignore:
10+
- translations
11+
12+
jobs:
13+
see_if_should_skip:
14+
runs-on: ubuntu-latest
15+
16+
outputs:
17+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
18+
steps:
19+
- id: skip_check
20+
uses: fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289
21+
with:
22+
cancel_others: 'false'
23+
github_token: ${{ github.token }}
24+
paths: '["**/*.json", ".github/workflows/json-lint.yml"]'
25+
26+
lint:
27+
runs-on: ubuntu-latest
28+
needs: see_if_should_skip
29+
if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
30+
steps:
31+
- name: Check out repo
32+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
33+
34+
- name: Setup node
35+
uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d
36+
with:
37+
node-version: 14.x
38+
39+
- name: Get npm cache directory
40+
id: npm-cache
41+
run: |
42+
echo "::set-output name=dir::$(npm config get cache)"
43+
44+
- name: Cache node modules
45+
uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a
46+
with:
47+
path: ${{ steps.npm-cache.outputs.dir }}
48+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
49+
restore-keys: |
50+
${{ runner.os }}-node-
51+
52+
- name: Install dependencies
53+
run: npm ci
54+
55+
- name: Run linter
56+
run: npx prettier -c "**/*.json"

0 commit comments

Comments
 (0)