Skip to content

Commit a6872ca

Browse files
authored
fix(ci): use npm-shrinkwrap.json for node_modules cache key (#1325)
hashFiles('package-lock.json') returns empty string since only npm-shrinkwrap.json is tracked, causing all runs to share a single stale cache key. This led to lint and typecheck failures when the stale node_modules had outdated type definitions.
1 parent 44b5c2c commit a6872ca

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

.github/workflows/lint.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/cache/save@v5
3030
with:
3131
path: node_modules
32-
key: node-modules-${{ hashFiles('package-lock.json') }}
32+
key: node-modules-${{ hashFiles('npm-shrinkwrap.json') }}
3333

3434
format:
3535
needs: setup
@@ -42,7 +42,7 @@ jobs:
4242
- uses: actions/cache/restore@v5
4343
with:
4444
path: node_modules
45-
key: node-modules-${{ hashFiles('package-lock.json') }}
45+
key: node-modules-${{ hashFiles('npm-shrinkwrap.json') }}
4646
- run: npm run format:check
4747

4848
lint:
@@ -56,7 +56,7 @@ jobs:
5656
- uses: actions/cache/restore@v5
5757
with:
5858
path: node_modules
59-
key: node-modules-${{ hashFiles('package-lock.json') }}
59+
key: node-modules-${{ hashFiles('npm-shrinkwrap.json') }}
6060
- run: npm run lint
6161

6262
security:
@@ -70,7 +70,7 @@ jobs:
7070
- uses: actions/cache/restore@v5
7171
with:
7272
path: node_modules
73-
key: node-modules-${{ hashFiles('package-lock.json') }}
73+
key: node-modules-${{ hashFiles('npm-shrinkwrap.json') }}
7474
- run: npm run security:audit
7575

7676
secrets:
@@ -84,7 +84,7 @@ jobs:
8484
- uses: actions/cache/restore@v5
8585
with:
8686
path: node_modules
87-
key: node-modules-${{ hashFiles('package-lock.json') }}
87+
key: node-modules-${{ hashFiles('npm-shrinkwrap.json') }}
8888
- run: npm run secrets:check
8989

9090
typecheck:
@@ -98,7 +98,7 @@ jobs:
9898
- uses: actions/cache/restore@v5
9999
with:
100100
path: node_modules
101-
key: node-modules-${{ hashFiles('package-lock.json') }}
101+
key: node-modules-${{ hashFiles('npm-shrinkwrap.json') }}
102102
- run: npm run typecheck
103103

104104
schema-check:

0 commit comments

Comments
 (0)