facebook / memlab

A framework for finding JavaScript memory leaks and analyzing heap snapshots
https://facebook.github.io/memlab/
MIT License
4.35k stars 118 forks source link

chore: Use setup-node action to cache dependencies #23

Closed jongwooo closed 1 year ago

jongwooo commented 1 year ago

Signed-off-by: jongwooo han980817@gmail.com

Description

I changed the workflow to cache dependencies using actions/setup-node. actions/setup-node@v2 or newer has caching built-in so you no longer need to setup actions/cache.

AS-IS

- name: Setup Node
  uses: actions/setup-node@v3
  with:
    node-version: '16'

- name: Get yarn cache
  id: yarn-cache
  run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache dependencies
  uses: actions/cache@v2
  with:
    path: ${{ steps.yarn-cache.outputs.dir }}
    key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
    restore-keys: |
      ${{ runner.os }}-yarn-

TO-BE

- name: Setup Node
  uses: actions/setup-node@v3
  with:
    node-version: '16'
    cache: yarn

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

References

facebook-github-bot commented 1 year ago

@JacksonGL has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.