/
action.yml
37 lines (31 loc) · 1.25 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# See https://github.com/yarnpkg/berry/discussions/2621#discussioncomment-505872.
name: Set up yarn cache
description: >
Sets up caching for `yarn install` steps.
Caches yarn's cache directory, install state, and node_modules.
Caching the cache directory avoids yarn's fetch step and caching node_modules avoids yarn's link step.
runs:
using: composite
steps:
- name: 📁 Get yarn's cache directory
id: get-yarn-cache-directory
run: echo "CACHE_DIRECTORY=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
shell: bash
- name: ♻️ Restore yarn's cache
uses: actions/cache@v4
with:
path: ${{ steps.get-yarn-cache-directory.outputs.CACHE_DIRECTORY }}
key: yarn-cache-${{ runner.os }}
save-always: true
- name: ♻️ Restore yarn's install state
uses: actions/cache@v4
with:
path: .yarn/install-state.gz
key: yarn-install-state-${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock', '.yarnrc.yml') }}
save-always: true
- name: ♻️ Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: yarn-node-modules-${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock', '.yarnrc.yml') }}
save-always: true