Skip to content

Conversation

@jongwooo
Copy link

Description

Changed workflows to cache dependencies using actions/setup-node. setup-node@v2 or newer has caching built-in.

AS-IS

- name: Use Node.js ${{ matrix.node }}
  uses: actions/setup-node@v3
  with:
    node-version: ${{ matrix.node }}

- name: 'Cache node_modules'
  uses: actions/cache@v3
  with:
    path: '~/.npm'
    key: ${{ runner.os }}-node-v${{ matrix.node }}-integration-npm-210321-${{ hashFiles('**/package-lock.json') }} }}
    restore-keys: |
      ${{ runner.os }}-node-v${{ matrix.node }}-integration-npm-210321-

TO-BE

- name: Use Node.js ${{ matrix.node }}
  uses: actions/setup-node@v3
  with:
    node-version: ${{ matrix.node }}
    cache: npm

It’s literally a one line change to pass the cache: npm input parameter.

References

@jongwooo jongwooo force-pushed the ci/use-built-in-cache-action branch from 57c47bd to b7d3435 Compare November 13, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant