@@ -10,14 +10,27 @@ jobs:
10
10
runs-on : ubuntu-latest
11
11
strategy :
12
12
matrix :
13
- node : [ 14, 16, 18 ]
13
+ node : [14, 16, 18]
14
14
if : ${{ github.event_name != 'pull_request' }}
15
15
name : Test on main branch for node ${{ matrix.node }}
16
16
steps :
17
17
- uses : actions/checkout@v3
18
18
name : Checkout [main]
19
19
with :
20
20
fetch-depth : 0
21
+
22
+ - name : Get yarn cache directory path
23
+ id : yarn-cache-dir-path
24
+ run : echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
25
+
26
+ - uses : actions/cache@v3
27
+ id : yarn-cache
28
+ with :
29
+ path : ${{ steps.yarn-cache-dir-path.outputs.dir }}
30
+ key : ${{ runner.os }}-node${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
31
+ restore-keys : |
32
+ ${{ runner.os }}-node${{ matrix.node }}-yarn-
33
+
21
34
- uses : actions/setup-node@v3
22
35
name : Setup Node
23
36
with :
@@ -27,14 +40,27 @@ jobs:
27
40
pr :
28
41
strategy :
29
42
matrix :
30
- node : [ 14, 16, 18 ]
43
+ node : [14, 16, 18]
31
44
runs-on : ubuntu-latest
32
45
if : ${{ github.event_name == 'pull_request' }}
33
46
steps :
34
47
- uses : actions/checkout@v3
35
48
with :
36
49
ref : ${{ github.event.pull_request.head.ref }}
37
50
fetch-depth : 0
51
+
52
+ - name : Get yarn cache directory path
53
+ id : yarn-cache-dir-path
54
+ run : echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
55
+
56
+ - uses : actions/cache@v3
57
+ id : yarn-cache
58
+ with :
59
+ path : ${{ steps.yarn-cache-dir-path.outputs.dir }}
60
+ key : ${{ runner.os }}-node${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
61
+ restore-keys : |
62
+ ${{ runner.os }}-node${{ matrix.node }}-yarn-
63
+
38
64
- uses : actions/setup-node@v1
39
65
with :
40
66
node-version : ${{ matrix.node }}
0 commit comments