Skip to content

Commit 678bef3

Browse files
committed
Refactor npm-test workflow to simplify node setup
- Remove redundant caching steps for node_modules - Consolidate setup-node action parameters
1 parent 6c439bc commit 678bef3

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

.github/workflows/npm-test.yaml

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,11 @@ jobs:
3131

3232
steps:
3333
- uses: actions/checkout@v4
34-
3534
- uses: actions/setup-node@v4
3635
with:
37-
node-version: ${{ matrix.node }}
38-
39-
- name: Cache node_modules
40-
uses: actions/cache@v4
41-
with:
42-
# Cache key uses the contents of `package-lock.json` to identify unique cache
43-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
44-
restore-keys: |
45-
${{ runner.OS }}-node-
46-
path: |
47-
node_modules
36+
cache: 'npm'
37+
cache-dependency-path: package-lock.json
38+
registry-url: https://registry.npmjs.org/
4839

4940
- run: npm ci
5041
- run: npm test
@@ -55,21 +46,12 @@ jobs:
5546
runs-on: ubuntu-latest
5647
steps:
5748
- uses: actions/checkout@v4
58-
5949
- uses: actions/setup-node@v4
6050
with:
51+
cache: 'npm'
52+
cache-dependency-path: package-lock.json
6153
registry-url: https://registry.npmjs.org/
6254

63-
- name: Cache node_modules
64-
uses: actions/cache@v4
65-
with:
66-
# Cache key uses the contents of `package-lock.json` to identify unique cache
67-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
68-
restore-keys: |
69-
${{ runner.OS }}-node-
70-
path: |
71-
node_modules
72-
7355
- run: npm ci
7456
- run: npm publish
7557
env:

0 commit comments

Comments
 (0)