-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (60 loc) · 2.26 KB
/
Copy pathnode.yml
File metadata and controls
71 lines (60 loc) · 2.26 KB
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
61
62
63
64
65
66
67
68
69
70
71
name: Node
on: workflow_call
jobs:
node:
name: Node
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 20 ]
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Paths filters
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: paths
with:
filters: |
workflows: &workflows
- '.github/actions/**/*.yml'
- '.github/workflows/**/*.yml'
npm: &npm
- *workflows
- 'package.json'
- 'package-lock.json'
javascript: &javascript
- *workflows
- '**/*.js'
eslint:
- *workflows
- *javascript
- *npm
- '**/*.json'
- '.eslintignore'
- '.eslintrc.js'
- name: Set up Node
if: ${{ toJSON( steps.paths.outputs.changes ) != '"[]"' }}
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
if: ${{ toJSON( steps.paths.outputs.changes ) != '"[]"' && steps.cache-node-dependencies.outputs.cache-hit != 'true' }}
run: npm ci --progress=false --audit=false --fund=false
- name: Lint code and save linting report JSON
if: ${{ steps.paths.outputs.eslint == 'true' }}
run: npm run lint -- --output-file eslint_report.json --format json
# Continue to the next step even if this fails, so we can report on it.
continue-on-error: true
- name: Annotate Code Linting Results
uses: ataylorme/eslint-annotate-action@d57a1193d4c59cbfbf3f86c271f42612f9dbd9e9 # v3.0.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
report-json: 'eslint_report.json'
only-pr-files: true
- name: Run tests
if: ${{ steps.paths.outputs.javascript == 'true' || steps.paths.outputs.npm == 'true' }}
run: npm test
- name: Build application
if: ${{ steps.paths.outputs.javascript == 'true' || steps.paths.outputs.npm == 'true' }}
run: npm run build