-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (41 loc) · 1.28 KB
/
lint.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
43
44
45
46
47
48
49
50
51
52
53
54
name: Linting
on:
push:
pull_request:
jobs:
cache-keys:
name: Setup – Cache keys
runs-on: ubuntu-latest
outputs:
build: build-${{ steps.build.outputs.hash }}-v2
dot-cache: dot-cache-${{ github.event.number }}-v1
node-modules: node-modules-${{ steps.node-modules.outputs.hash }}-v1
steps:
- name: Checkout
uses: actions/checkout@v4
- id: build
run: echo "::set-output name=hash::${{ hashFiles('assets/**', 'content/**', 'layouts/**', 'static/**', '**/package.json', '**/package-lock.json') }}"
- id: node-modules
run: echo "::set-output name=hash::${{ hashFiles('**/package-lock.json') }}"
test-lint:
name: Test – Lint
needs: cache-keys
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Get cached dependencies
uses: actions/cache@v4
with:
path: |
node_modules
key: ${{ needs.cache-keys.outputs.node-modules }}
- name: Check that package-lock.json is valid JSON
run: jq empty package-lock.json
- name: Install dependencies
run: npm ci
- name: Run linters
run: npm run lint