@@ -17,26 +17,27 @@ jobs:
1717 lint :
1818 runs-on : ubuntu-latest
1919 steps :
20- - uses : actions/checkout@v2
20+ - uses : actions/checkout@v4
2121
2222 - name : Use Node.js
23- uses : actions/setup-node@v2
23+ uses : actions/setup-node@v4
2424 with :
2525 node-version-file : ' .nvmrc'
2626
27+ # https://github.com/actions/cache/blob/main/examples.md#node---npm
28+ - name : Get npm cache directory
29+ id : npm-cache-dir
30+ shell : bash
31+ run : echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
32+
2733 - name : Cache node modules
28- uses : actions/cache@v2
29- env :
30- cache-name : cache-node-modules
34+ uses : actions/cache@v4
35+ id : npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
3136 with :
32- path : |
33- ~/.npm
34- **/node_modules
35- key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
37+ path : ${{ steps.npm-cache-dir.outputs.dir }}
38+ key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
3639 restore-keys : |
37- ${{ runner.os }}-build-${{ env.cache-name }}-
38- ${{ runner.os }}-build-
39- ${{ runner.os }}-
40+ ${{ runner.os }}-node-
4041
4142 - name : Install deps
4243 run : npm ci --audit=false
@@ -56,28 +57,29 @@ jobs:
5657 PGPASSWORD : postgres
5758 PGDATABASE : postgres
5859 steps :
59- - uses : actions/checkout@v2
60+ - uses : actions/checkout@v4
6061 with :
6162 fetch-depth : 0
6263
6364 - name : Use Node.js
64- uses : actions/setup-node@v2
65+ uses : actions/setup-node@v4
6566 with :
6667 node-version-file : ' .nvmrc'
6768
69+ # https://github.com/actions/cache/blob/main/examples.md#node---npm
70+ - name : Get npm cache directory
71+ id : npm-cache-dir
72+ shell : bash
73+ run : echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
74+
6875 - name : Cache node modules
69- uses : actions/cache@v2
70- env :
71- cache-name : cache-node-modules
76+ uses : actions/cache@v4
77+ id : npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
7278 with :
73- path : |
74- ~/.npm
75- **/node_modules
76- key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
79+ path : ${{ steps.npm-cache-dir.outputs.dir }}
80+ key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
7781 restore-keys : |
78- ${{ runner.os }}-build-${{ env.cache-name }}-
79- ${{ runner.os }}-build-
80- ${{ runner.os }}-
82+ ${{ runner.os }}-node-
8183
8284 - name : Install deps
8385 run : npm ci --audit=false
@@ -108,7 +110,7 @@ jobs:
108110 - lint
109111 - test
110112 steps :
111- - uses : actions/checkout@v3
113+ - uses : actions/checkout@v4
112114 with :
113115 token : ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
114116 fetch-depth : 0
0 commit comments