Skip to content

Commit b714946

Browse files
committed
Update cache key logic in Node.js setup action: include package.json in hash to avoid stale node_modules.
1 parent bd03e27 commit b714946

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/actions/setup/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ runs:
1515
backend/shared/node_modules
1616
backend/email/node_modules
1717
common/node_modules
18-
key: node-modules-${{ hashFiles('**/yarn.lock') }}
18+
# The package.json files are part of the key, not just the lockfile: adding a dependency
19+
# whose exact version another workspace already pins leaves yarn.lock byte-identical, and
20+
# keying on the lockfile alone would then restore a node_modules that never installed it.
21+
# node_modules doesn't exist yet at this point, but exclude it so that stays true.
22+
key: node-modules-${{ hashFiles('**/yarn.lock', '**/package.json', '!**/node_modules/**') }}
1923

2024
- name: Setup Node.js
2125
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)