From 8780a54a110d15f052633cb7ddc61322f6851326 Mon Sep 17 00:00:00 2001 From: microshine Date: Thu, 13 Jun 2024 15:39:19 +0200 Subject: [PATCH] ci: Update cache action --- .github/workflows/test.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 956563f..d3beaf1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,17 +42,18 @@ jobs: sudo apt-get update -y sudo apt-get install -y libnss3-tools - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules + - name: Get npm cache directory + id: npm-cache-dir + shell: bash + run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} + + - uses: actions/cache@v4 + id: npm-cache with: - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + ${{ runner.os }}-node- - name: Install dependencies run: npm install