diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index 73a2af5c296..6b3af753492 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -41,7 +41,7 @@ jobs: git config --global core.eol lf - if: steps.should_run.outputs.shouldrun == 'true' name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - if: steps.should_run.outputs.shouldrun == 'true' name: Check if Node.js project and has package.json id: packagejson @@ -53,7 +53,7 @@ jobs: id: lockversion - if: steps.packagejson.outputs.exists == 'true' name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "${{ steps.lockversion.outputs.version }}" cache: 'npm' @@ -65,9 +65,14 @@ jobs: continue-on-error: true - if: steps.first-installation.outcome != 'success' && steps.packagejson.outputs.exists == 'true' name: Clear NPM cache and install deps again + id: second-installation run: | npm cache clean --force npm ci + continue-on-error: true + - if: steps.second-installation.outcome != 'success' && steps.packagejson.outputs.exists == 'true' + name: Install without cache + run: npm ci --no-cache - if: steps.packagejson.outputs.exists == 'true' name: Test run: npm test --if-present diff --git a/.github/workflows/if-nodejs-release.yml b/.github/workflows/if-nodejs-release.yml index f407e59ae3d..5efc924c17f 100644 --- a/.github/workflows/if-nodejs-release.yml +++ b/.github/workflows/if-nodejs-release.yml @@ -39,7 +39,7 @@ jobs: git config --global core.autocrlf false git config --global core.eol lf - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check if Node.js project and has package.json id: packagejson run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT @@ -50,14 +50,26 @@ jobs: id: lockversion - if: steps.packagejson.outputs.exists == 'true' name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "${{ steps.lockversion.outputs.version }}" cache: 'npm' cache-dependency-path: '**/package-lock.json' - if: steps.packagejson.outputs.exists == 'true' name: Install dependencies - run: npm install + id: first-installation + run: npm ci + continue-on-error: true + - if: steps.first-installation.outcome != 'success' && steps.packagejson.outputs.exists == 'true' + name: Clear NPM cache and install deps again + id: second-installation + run: | + npm cache clean --force + npm ci + continue-on-error: true + - if: steps.second-installation.outcome != 'success' && steps.packagejson.outputs.exists == 'true' + name: Install without cache + run: npm ci --no-cache - if: steps.packagejson.outputs.exists == 'true' name: Run test run: npm test --if-present @@ -104,9 +116,14 @@ jobs: continue-on-error: true - if: steps.first-installation.outcome != 'success' && steps.packagejson.outputs.exists == 'true' name: Clear NPM cache and install deps again + id: second-installation run: | npm cache clean --force npm ci + continue-on-error: true + - if: steps.second-installation.outcome != 'success' && steps.packagejson.outputs.exists == 'true' + name: Install without cache + run: npm ci --no-cache - if: steps.packagejson.outputs.exists == 'true' name: Add plugin for conventional commits for semantic-release run: npm install --save-dev conventional-changelog-conventionalcommits@5.0.0