fix: resolve pnpm version from action package.json via bash#3
Merged
Conversation
…ckage_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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second bug caught by the same e2e run
After #2 landed and I re-ran the e2e caller,
Set up Node.jssucceeded butset up pnpmfailed with:Same class of bug:
pnpm/action-setup'spackage_json_fileinput has the same resolution quirk asactions/setup-node'snode-version-file. An absolute path fromgithub.action_pathgets concatenated with$GITHUB_WORKSPACE, the file isn't found, and the action silently falls back to the caller'spackage.json(which does not declare apackageManagerfield).Fix
Same pattern PR #2 used: a preceding
bashstep reads the value from the action's ownpackage.json(via${GITHUB_ACTION_PATH}) into a step output and passes the literal version string tosetup-pnpmviaversion.Uses
node -pbecause setup-node has just run, so Node is on PATH.Verification
pnpm run lint,format:check,typecheck,testall green (87 engine tests + docs-invariants scaffold).Follow-up thought
Both of these bugs share a root cause — third-party actions with absolute-path resolution quirks. Worth considering an in-repo smoke workflow (
.github/workflows/e2e-smoke.yml) that self-invokes the composite viauses: ./and checks off the "each step's inputs resolve correctly" case on every PR. Not blocking this fix; noted as follow-up in project state.