DEV Community

Discussion on: How to cache node_modules in GitHub Actions with Yarn

Collapse
 
vashchukmaksim profile image
Vashchuk Maksim

On a second run I got a message:

Cache restored from key: node_modules-7895c53553e57f00e1fd69b577ee8f44d76199b1c231a85c936c5886d7416416

but the next step (yarn install) still takes the same time (almost 2 minutes) and looks like it install everything from scratch.

Why could this happen?

Collapse
 
w4lly profile image
Walter Zalazar • Edited

in the post is missing the if condition, like this

- name: Install dependencies
  if: steps.yarn-cache.outputs.cache-hit != 'true'
  run: yarn install
Enter fullscreen mode Exit fullscreen mode
Collapse
 
ffxsam profile image
Sam Hulick

@mpocock1 Could you please update your post with this important step?

Collapse
 
mdirshaddev profile image
Md Irshad

Yes in the docs it is also mention to do like this.