summaryrefslogtreecommitdiff
path: root/.github/workflows/javascript-code-quality.yml
blob: 5316932508d6565c2f88fd8b67cd8c01ab6df0a0 (plain)
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
55
56
57
58
59
60
name: JavaScript Code Quality

on:
  pull_request:
    paths:
    - 'js/**.js'
    - 'plugins/**.js'
    - 'eslint.config.js'
    - 'package.json'
    - 'package-lock.json'
  # Allow manual triggering
  workflow_dispatch:
  # Allow other workflows (e.g. Publish) to invoke this one.
  workflow_call:


env:
  fail-fast: true


permissions:
  contents: read


jobs:
  eslint:
    name: ESLint
    runs-on: ubuntu-latest

    steps:
    - name: Check out code
      uses: actions/checkout@v5

    - name: Set up Node.js
      uses: actions/setup-node@v5
      with:
        node-version: lts/*

    - name: Restore Node.js dependencies cache
      uses: actions/cache/restore@v4
      id: cache-restore
      with:
        path: node_modules
        key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
        restore-keys: |
          ${{ runner.os }}-node-

    - name: Install dependencies
      if: steps.cache-restore.outputs.cache-hit != 'true'
      run: npm install

    - name: Save Node.js dependencies cache
      if: steps.cache-restore.outputs.cache-hit != 'true'
      uses: actions/cache/save@v4
      with:
        path: node_modules
        key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}

    - name: Run ESLint
      run: npx eslint js plugins