From c5ad309f4fdfc632a916ab11ecb243c2f855711d Mon Sep 17 00:00:00 2001 From: Michele Mancioppi Date: Wed, 8 Jul 2026 13:36:42 +0200 Subject: [PATCH] fix: resolve pnpm version from action's package.json via node, not package_json_file Same class of bug as #2 (Node version): `pnpm/action-setup`'s `package_json_file` input is resolved relative to `$GITHUB_WORKSPACE`. Passing an absolute path from `github.action_path` produces a non-existent file; the action silently falls back to the caller's package.json (which does not declare `packageManager`) and fails with: Error: No pnpm version is specified. Please specify it by one of the following ways: - in the GitHub Action config with the key "version" - in the package.json with the key "packageManager" - in the package.json with the key "devEngines.packageManager" Caught by the second e2e run against dash0hq/sync-docs-e2e-source (after PR #2 fixed the analogous node-version-file resolution). Fix: read the version from the action's package.json in a preceding bash step (Node is on PATH since setup-node just ran) and pass the literal version string to setup-pnpm via `version`. Consistent with the pattern PR #2 established for the Node version. Local verification: pnpm lint, format:check, typecheck, and the 87 engine tests + docs-invariants scaffold test all green. --- action.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index ee92cec..5615621 100644 --- a/action.yml +++ b/action.yml @@ -80,12 +80,23 @@ runs: with: node-version: ${{ steps.node-version.outputs.version }} + - name: Read required pnpm version from the action's package.json + id: pnpm-version + shell: bash + # `pnpm/action-setup`'s `package_json_file` input has the same resolution quirk as + # `actions/setup-node`'s `node-version-file`: absolute paths derived from `github.action_path` + # get concatenated with `$GITHUB_WORKSPACE` and the file is not found, at which point the + # action silently falls back to the caller's package.json (which does not declare a + # `packageManager` field) and fails with "No pnpm version is specified". Read the value here + # and pass it as a literal `version` instead. Node is on PATH because setup-node just ran. + run: | + version=$(node -p "require('${GITHUB_ACTION_PATH}/package.json').packageManager.replace('pnpm@', '')") + echo "version=$version" >> "$GITHUB_OUTPUT" + - name: set up pnpm uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5 with: - # The action stores its own package manager version in package.json; use it here so pnpm and - # setup-node agree on the layout of node_modules. - package_json_file: ${{ github.action_path }}/package.json + version: ${{ steps.pnpm-version.outputs.version }} run_install: false - name: install action dependencies