Skip to content

Commit 0373fff

Browse files
committed
chore: remove branch from the cache key
1 parent 89fc46f commit 0373fff

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

.github/actions/npm-setup/action.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ runs:
2323
id: npm-cache
2424
with:
2525
path: node_modules
26-
key: ${{ github.head_ref || 'main' }}-${{ inputs.runner }}-node-${{ inputs.node-version }}-${{ inputs.workspace }}-${{ hashFiles('**/package-lock.json') }}
26+
# the key is built using both package-lock.json files: the one in the root dir and the one for the module to be built
27+
key: ${{ inputs.runner }}-node-${{ inputs.node-version }}-${{ inputs.workspace }}-${{ hashFiles(format('{0}-{1}/{2}', 'package-lock.json', inputs.workspace, 'package-lock.json')) }}
2728
restore-keys: |
28-
${{ github.head_ref || 'main' }}-${{ inputs.runner }}-node-${{ inputs.node-version }}-${{ inputs.workspace }}-
29+
${{ inputs.runner }}-node-${{ inputs.node-version }}-${{ inputs.workspace }}-
2930
- name: Install dependencies
3031
if: steps.npm-cache.outputs.cache-hit != 'true'
3132
shell: bash
32-
run: npm ci --omit=optional
33+
run: npm ci --omit=optional -- ${{ inputs.workspace }}
3334
- name: Cache npm
3435
id: cache-npm-save
3536
if: steps.npm-cache.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)