From 7deb19dd92c16c250729bcf2bfb7d9b3215c2f61 Mon Sep 17 00:00:00 2001 From: pramodjodhani Date: Mon, 6 Jul 2026 14:44:52 +0530 Subject: [PATCH 1/2] fix: only enable npm cache in setup-node when a lockfile exists Bun-only repos have no package-lock.json, which made setup-node's npm cache restore fail with "Dependencies lock file is not found." --- .github/workflows/zip.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/zip.yml b/.github/workflows/zip.yml index e8b4aed..84d86bc 100644 --- a/.github/workflows/zip.yml +++ b/.github/workflows/zip.yml @@ -98,11 +98,20 @@ jobs: echo "exists=false" >> $GITHUB_OUTPUT fi + - name: Check for npm lockfile + id: check-lockfile + run: | + if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ] || [ -f yarn.lock ]; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + fi + - uses: actions/setup-node@v4 if: steps.check-nvmrc.outputs.exists == 'true' with: node-version-file: '.nvmrc' - cache: 'npm' + cache: ${{ steps.check-lockfile.outputs.exists == 'true' && 'npm' || '' }} - name: Set up authentication for NODE_AUTH_TOKEN if present run: | From 18e15be32f807c1c4307fdfae9568ec7c25f7844 Mon Sep 17 00:00:00 2001 From: pramodjodhani Date: Mon, 6 Jul 2026 19:35:07 +0530 Subject: [PATCH 2/2] add comment explaining the reason for the check-lockfile step --- .github/workflows/zip.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/zip.yml b/.github/workflows/zip.yml index 84d86bc..a968065 100644 --- a/.github/workflows/zip.yml +++ b/.github/workflows/zip.yml @@ -98,6 +98,10 @@ jobs: echo "exists=false" >> $GITHUB_OUTPUT fi + # ------------------------------------------------------------------------------ + # Ensures actions/setup-node works as-expected in scenarios where a npm lockfile + # doesn't exist, such as when only bun is used. + # ------------------------------------------------------------------------------ - name: Check for npm lockfile id: check-lockfile run: |