Skip to content

fix: bin_dest output points to self-updated pnpm, not bootstrap#249

Merged
zkochan merged 3 commits intomasterfrom
fix/247
May 7, 2026
Merged

fix: bin_dest output points to self-updated pnpm, not bootstrap#249
zkochan merged 3 commits intomasterfrom
fix/247

Conversation

@zkochan
Copy link
Copy Markdown
Member

@zkochan zkochan commented May 7, 2026

Summary

  • Fixes Ignores version input #247: ${{ steps.pnpm.outputs.bin_dest }}/pnpm returned the bootstrap pnpm (currently 11.0.4) instead of the version requested via the version input.
  • pnpm self-update <version> writes the target binary to ${PNPM_HOME}/bin/, leaving the bootstrap symlink in ${PNPM_HOME}/pnpm untouched. bin_dest was set to ${PNPM_HOME}, so direct invocations got the bootstrap.
  • PATH lookup masked the bug — ${PNPM_HOME}/bin was prepended ahead of ${PNPM_HOME}, so pnpm resolved through PATH worked. Existing version-respect tests only checked pnpm --version, never ${bin_dest}/pnpm.
  • Resolve binDest inside runSelfInstaller (target lives in ${PNPM_HOME}/bin after self-update, otherwise stays at ${PNPM_HOME} so the Corepack/packageManager flow keeps working) and plumb it to setOutputs.

Test plan

  • New test_bin_dest_output workflow job exercises ${{ steps.pnpm.outputs.bin_dest }}/pnpm --version for 9.15.5 and 10.33.2 on ubuntu-latest, macos-latest, windows-latest.
  • Local repro before fix: ${bin_dest}/pnpm --version reported 11.0.4 for version: 10.33.2. After fix: reports 10.33.2.
  • Local check of the no-version-input branch (packageManager: pnpm@9.15.5): bin_dest still points to ${PNPM_HOME}/, ${bin_dest}/pnpm --version reports 9.15.5 via Corepack.
  • tsc --noEmit clean.
  • dist/index.js rebuilt.

Summary by CodeRabbit

  • Bug Fixes

    • Improved installation failure handling so the workflow fails fast and avoids running subsequent steps when the pnpm install is unsuccessful.
  • Outputs

    • Action now exposes the exact pnpm binary destination as an output for consumers to use reliably.
  • Tests

    • Added cross-platform test validating the pnpm binary version reported by the action matches the requested version.

`pnpm self-update <version>` writes the target binary to
`${PNPM_HOME}/bin/`, leaving the bootstrap symlink at `${PNPM_HOME}/pnpm`
untouched. The `bin_dest` output was set to `${PNPM_HOME}`, so consumers
invoking `${{ steps.pnpm.outputs.bin_dest }}/pnpm` got the bootstrap
version (currently 11.0.4) instead of the version they requested.

PATH lookup hid the bug: `${PNPM_HOME}/bin` was prepended ahead of
`${PNPM_HOME}`, so `pnpm` resolved from PATH was the right one. Existing
version-respect tests only checked `pnpm --version`, not `bin_dest`.

Resolve `binDest` inside `runSelfInstaller` (target lives in
`${PNPM_HOME}/bin` after self-update, otherwise stays at `${PNPM_HOME}`)
and plumb it through to `setOutputs`. Add a regression test that invokes
`${bin_dest}/pnpm --version` directly across Linux/macOS/Windows.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • dist/index.js is excluded by !**/dist/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e121b60-3361-4a22-be4e-6c9593a47404

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR threads a structured installer result containing binDest through install, setOutputs, and runMain, and adds a CI job verifying the action's published bin_dest points to the requested pnpm version.

Changes

Binary Destination Output Threading

Layer / File(s) Summary
Installer Result Contract
src/install-pnpm/run.ts
Introduces SelfInstallerResult interface with exitCode: number and binDest: string fields.
Installer Implementation Returns
src/install-pnpm/run.ts
Updates runSelfInstaller to return { exitCode, binDest } with binDest pointing to bootstrap .bin on npm ci failure, PNPM_HOME/bin when target version succeeds, or pnpmHome when no target version is set.
Install Function Signature and Handling
src/install-pnpm/index.ts
Updates install to return Promise<string | undefined>, destructure { exitCode, binDest } from installer result, call setFailed on non-zero exitCode, and return binDest or undefined.
Output Function Signature
src/outputs/index.ts
Updates setOutputs to accept explicit binDest: string parameter instead of computing it internally via getBinDest.
Main Action Flow Threading
src/index.ts
Updates runMain to capture binDest from install, return early if binDest is undefined, and pass binDest to setOutputs.
Test Coverage for bin_dest Output
.github/workflows/test.yaml
Adds test_bin_dest_output job to verify the pnpm binary at bin_dest output reports the requested version across ubuntu-latest, macos-latest, windows-latest with pnpm 9.15.5 and 10.33.2.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • pnpm/action-setup#241: Both PRs modify src/install-pnpm/run.ts and the installer flow (this PR adds binDest to the return type; that PR adjusts bootstrap PATH handling).

Poem

🐰 I hopped through code to find the bin,
Threaded its path from end to begin,
Now CI checks the version with glee,
The rabbit ensures the right pnpm is free. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main fix: the bin_dest output now correctly points to the self-updated pnpm binary instead of the bootstrap version.
Linked Issues check ✅ Passed The PR addresses all objectives from #247: respecting version input for direct binary invocations via bin_dest, fixing the mismatch between bootstrap and self-updated binaries, and restoring v5 behavior.
Out of Scope Changes check ✅ Passed All changes directly support the fix: workflow test job validates the fix, index.ts threads binDest through the call chain, run.ts resolves correct binary path, outputs function exposes it, and install function returns the resolved path.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/247

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/test.yaml:
- Around line 199-200: The invocation that builds the actual pnpm version uses
an unquoted executable path (the expression that references
steps.pnpm.outputs.bin_dest), which will break if the bin_dest contains spaces;
update the assignment that sets actual to quote the executable path portion when
invoking pnpm (i.e., wrap the expanded ${ { steps.pnpm.outputs.bin_dest } }/pnpm
in quotes) so the shell treats the full path as a single token while still
passing --version.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c703c871-5db9-4c4c-a0ef-e0e4f23c3d8e

📥 Commits

Reviewing files that changed from the base of the PR and between e578e19 and 624e28f.

⛔ Files ignored due to path filters (1)
  • dist/index.js is excluded by !**/dist/**
📒 Files selected for processing (5)
  • .github/workflows/test.yaml
  • src/index.ts
  • src/install-pnpm/index.ts
  • src/install-pnpm/run.ts
  • src/outputs/index.ts

Comment thread .github/workflows/test.yaml Outdated
zkochan added 2 commits May 7, 2026 08:59
Direct GitHub-expression interpolation of `${{ steps.pnpm.outputs.bin_dest }}`
into the bash script let bash eat the backslashes in the Windows path
(`C:Usersrunneradminsetup-pnpmnode_modules.binbin/pnpm`), failing with
"No such file or directory". Forward the value via env so the path
reaches bash unmangled.
@zkochan zkochan merged commit 91ab88e into master May 7, 2026
78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignores version input

1 participant