pnpm provisioning
pnpm provisioning gives the workflow run one pnpm command at the requested version. The action selects that version from its inputs or the repository manifest, installs a locked bootstrap package, updates it to the target when needed, and places the resulting commands on PATH for later work.
Provisioning lifecycle
Provisioning runs before cache restoration and dependency installation. It must finish successfully before the action exposes its outputs or asks any later stage to run pnpm.
This diagram shows how the action turns version settings into a pnpm command for the rest of the run.
flowchart LR
A[Action inputs and repository manifest] --> B[Select target version]
B --> C[Choose native, Node-backed, or standalone bootstrap]
C --> D[Install locked bootstrap package]
D --> E[Update bootstrap to target version]
E --> F[Set PATH and PNPM_HOME]
F --> G[Expose bin_dest]
G --> H[Cache, install, and post-run steps]
References: src/…/run.ts• L38-55 src/index.ts• L18-31 src/…/index.ts• L7-16
Version selection
The target version is the version that all later pnpm commands should use. The action accepts an explicit version; when it is absent, it reads the configured manifest in the checked-out workspace.
Selection precedence
The selection rules prevent a hidden version mismatch between the action and the project. An explicit action version wins over manifest settings, but it must agree with the manifest's exact packageManager version when both are present.
| Source | Use |
|---|---|
Action version input | Use this value. Reject it if an exact packageManager version differs. |
devEngines.packageManager with name pnpm | Use its version or range when no action version is set. |
packageManager beginning with pnpm@ | Use its exact pnpm version when no higher-priority value is set. |
| No usable source | Stop with an error instead of selecting an arbitrary pnpm version. |
The manifest path is relative to GITHUB_WORKSPACE. Therefore, a workflow that relies on a manifest version must check out the repository before this action runs. The action removes an integrity suffix from packageManager because self-update needs the version value, not the package integrity data.
References: src/…/run.ts• L131-203 action.yml• L7-10 action.yml• L26-29
Bootstrap modes
The bootstrap is a temporary pnpm installation that gives the action a known command before the requested version is available. The action installs one of three locked packages, then uses that command to obtain the target version.
Native pnpm bootstrap
The native mode is used for pnpm 12 targets. It installs the pnpm package with platform-specific executable packages, so the bootstrap does not depend on the older Node-backed pnpm package or the standalone executable package. The committed native lock fixes the bootstrap at pnpm 12.17.0 and records platform-specific packages for the supported systems.
When the target is the native bootstrap version, or a range that contains it, the action can use the bootstrap directly. Otherwise it runs self-update to place the requested pnpm version in the target command directory.
References: src/…/run.ts• L15-17 src/…/run.ts• L38-52 src/…/run.ts• L102-115 src/…/native-lock.json• L6-9 src/…/native-lock.json• L214-245
Node-backed bootstrap
The normal mode installs the pnpm package and runs its command with the runner's Node.js. This mode is used for non-pnpm 12 targets when the available Node.js meets the bootstrap package's requirement of Node 22.13 or later.
The bootstrap package is currently locked at pnpm 11.28.10. Its engine requirement is why the action checks the runner's Node version before choosing this mode.
References: src/…/run.ts• L15-16 src/…/run.ts• L40-45 src/…/run.ts• L51-52 src/…/pnpm-lock.json• L6-28
Standalone bootstrap
Standalone mode installs @pnpm/exe, which includes Node.js with pnpm. For non-pnpm 12 targets, the action selects this mode when standalone is true or when the system Node.js is below the Node-backed bootstrap requirement. This lets pnpm start when the runner's Node.js is too old or is not the runtime that should execute pnpm.
The standalone package is locked at version 11.28.10 and supplies platform-specific binaries. On Windows, the action exposes that binary directory directly because a package-manager shim can otherwise point to the temporary bootstrap instead of the updated pnpm command.
References: src/…/run.ts• L16-17 src/…/run.ts• L40-45 src/…/run.ts• L52-55 src/…/run.ts• L76-85 src/…/run.ts• L102-115 src/…/exe-lock.json• L6-37 action.yml• L30-33
Command exposure
After the bootstrap is installed, the action runs pnpm self-update for the selected target when the bootstrap is not already suitable. It then exposes the directory that contains the target pnpm and pnpx commands through the runner environment and through the bin_dest output.
The bootstrap install uses npm with the committed lockfile. For that install only, the action appends its own Node directory to the current PATH, so a user-installed Node toolchain keeps precedence while npm can still find Node on runners where it is not already on PATH.
PATH precedence
The updated command directory takes precedence over the bootstrap directory. This order matters because later stages resolve pnpm by name, including cache and store operations. The action exports PNPM_HOME for pnpm's command location and keeps the same inherited environment for dependency installation and store pruning.
References: src/…/run.ts• L57-71 src/…/run.ts• L76-86 src/…/run.ts• L119-128 src/…/index.ts• L14-24 src/…/index.ts• L11-17
Output contract
bin_dest identifies the directory that contains the usable commands. Consumers that need an explicit command path should use ${{ steps.<step-id>.outputs.bin_dest }}/pnpm; consumers that run pnpm normally use the updated PATH. The dest output identifies the expanded storage path for the action's pnpm files.
If self-update does not create a separate target directory because the target already matches the bootstrap, bin_dest falls back to the bootstrap directory. In both cases it points to a working command location rather than merely to the action's storage root.
References: src/…/run.ts• L102-128 src/…/index.ts• L4-9 action.yml• L34-38
Workflow handoff
The main action flow stops when provisioning fails. On success, it publishes the outputs, restores the pnpm store if requested, and then runs configured dependency installs. The post phase later uses the same resolved command environment for store cleanup and cache saving.
For the surrounding order and input rules, see action runtime and action inputs. For the locked bootstrap packages, see embedded bootstrap artifacts. For consumers of the command, see dependency installation, cache restoration, pnpm store pruning, and action outputs.
References: src/index.ts• L18-37 src/…/index.ts• L11-24 src/…/index.ts• L11-17
Change checklist
When these files or sections are changed, remember to consider these:
- Keep each bootstrap package version, resolved archive, and integrity value aligned with its lockfile and package definition.
- Keep the native target range aligned with the native bootstrap package and its platform-specific packages.
- Preserve the target-over-bootstrap
PATHorder when changing self-update or command exposure logic. - Preserve the Windows standalone binary path when changing package shims or
bin_desthandling. - Keep action.yml output names and descriptions aligned with the values published by src/…/index.ts.
- Keep the temporary npm environment separate from the inherited workflow environment when changing bootstrap installation. A user-selected Node toolchain must keep precedence.
- Keep the inherited environment contract aligned with dependency installation and store pruning, which resolve
pnpmby name. - Keep version precedence and conflict errors aligned with the manifest fields supported by the action.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
The workflow does not check out the repository and does not provide version. | The action cannot read a manifest target and fails before it exposes pnpm. | Check out the repository first or set the action's version input. |
version differs from an exact packageManager pnpm version. | Provisioning stops with a version mismatch error. | Keep one target version across the action input and manifest. |
| A pnpm 12 target is used with a native bootstrap that cannot run on the runner's platform. | Bootstrap installation or command startup fails before the target is exposed. | Keep the native lock's platform packages complete and use a supported runner. |
| The locked bootstrap install fails. | Self-installation returns a non-zero result and the action is marked failed. | Keep registry access available and do not remove or desynchronize the committed bootstrap lockfiles. |
A later step prepends the bootstrap .bin directory or calls that path directly. | The workflow can run the temporary pnpm version instead of the requested target. | Use the inherited PATH or the bin_dest output. |
| A caller uses a manifest path that is not relative to the workspace. | The action reads the wrong location or cannot find the requested pnpm version. | Set package_json_file to a workspace-relative manifest path. |
Key files
| File | Why to read it |
|---|---|
| src/…/run.ts | Defines version selection, bootstrap choice, self-update, npm setup, and command exposure. |
| src/…/index.ts | Shows how provisioning success or failure is returned to the main action flow. |
| src/index.ts | Shows where provisioning sits relative to outputs, cache restoration, installation, and post-run work. |
| action.yml | Defines the public provisioning inputs, outputs, storage default, and standalone option. |
| src/…/index.ts | Defines the output values that downstream workflow steps can use. |
| src/…/index.ts | Shows how later dependency commands inherit the provisioned pnpm environment. |
| src/…/index.ts | Shows that the post-run store command uses the same pnpm resolution path. |
| src/…/native-lock.json | Records the native pnpm 12 bootstrap and its platform packages. |
| src/…/pnpm-lock.json | Records the Node-backed bootstrap package and its engine requirement. |
| src/…/exe-lock.json | Records the standalone bootstrap package and supported platform binaries. |