Skip to content

Commit

Permalink
Improve node_modules caching
Browse files Browse the repository at this point in the history
This attempts to have the cache key derived from package-lock.json's
hash.
  • Loading branch information
tobyhs committed Jul 4, 2023
1 parent f5516fe commit ee0068d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ inputs:
runs:
using: composite
steps:
# We need to copy codemention's package-lock.json into the workspace
# because hashFiles only works on files inside the workspace.
- run: cp ${{ github.action_path }}/package-lock.json codemention-package-lock.json
shell: bash
- uses: actions/cache@v3
id: cache-node-modules
with:
path: ${{ github.action_path }}/node_modules
key: codemention-npm
key: codemention-npm-${{ hashFiles('codemention-package-lock.json') }}
- run: npm install
working-directory: ${{ github.action_path }}
shell: bash
if: steps.cache-node-modules.outputs.cache-hit != 'true'
- run: npm run build
working-directory: ${{ github.action_path }}
shell: bash
Expand Down

0 comments on commit ee0068d

Please sign in to comment.