Introducing a new way to review your PRs.

Read the announcement

pnpm / action-setup

Install pnpm package manager

View on GitHub

12 documents · Updated Nov 6, 2026

docs / action-packaging-and-maintenance

Action packaging and maintenance

This repository ships a GitHub Action that installs a requested pnpm version for workflow jobs. Its maintenance model keeps the checked-in action bundle and the embedded pnpm bootstrap lockfiles aligned with the source and with the validation checks. For runtime behavior, see Action runtime. For bootstrap updates, see Embedded bootstrap artifacts, and for the checks that protect these artifacts, see Continuous validation.

Distributable action

Action contract

The action contract is the public boundary used by GitHub Actions. It defines how a workflow selects a pnpm version and install behavior, and it exposes the paths that later steps use. The action has a main phase and a post phase so that setup work and later cleanup or cache work can share state. action.yml

References: action.yml• L1-42 src/index.ts• L10-41

Bundled entry point

GitHub Actions runs the checked-in dist/index.js, not the TypeScript source. The build turns the source entry point and its runtime dependencies into one Node 24 bundle. This lets a consuming workflow run the action without installing this repository's development tools. package.json, action.yml

The bundle is a release artifact. A source change is not available to action users until the bundle is rebuilt and the changed bundle is committed. dist/index.js

References: package.json• L4-8 action.yml• L39-42 dist/index.js• L1

Embedded bootstrap artifacts

Bootstrap roles

The action carries npm lockfiles as bootstrap data. Each lockfile gives npm a known package and integrity value before the action updates pnpm to the requested target. The lockfiles support three start paths:

  • pnpm-lock.json provides the normal pnpm 11 bootstrap.
  • exe-lock.json provides the standalone pnpm 11 executable with its own Node runtime.
  • native-lock.json provides the native pnpm 12 bootstrap and its platform packages.

The action chooses the native path for pnpm 12 targets. For older targets it chooses the standalone path when the runner Node version is too old or when standalone mode is requested. Otherwise it uses the normal path. src/…/run.ts, src/…/run.ts

References: src/…/run.ts• L10-29 src/…/run.ts• L37-52 src/…/pnpm-lock.json• L1-29 src/…/exe-lock.json• L1-35 src/…/native-lock.json• L1-35

Bootstrap refresh

The update-bootstrap command regenerates all three embedded lockfiles from npm. Its first version argument controls the legacy pnpm package used by the normal and standalone paths. Its second argument controls the native pnpm package used by the pnpm 12 path. When arguments are absent, the command resolves the latest matching npm dist tag for pnpm 11 and pnpm 12. package.json, scripts/update-bootstrap.mjs, scripts/update-bootstrap.mjs

The command creates temporary package metadata, asks npm to resolve only the lockfile, then writes the result into the embedded bootstrap directory. This keeps the package metadata and integrity data together for each start path. scripts/update-bootstrap.mjs

The three lockfiles do not represent one shared release. The legacy pair must match each other, while the native lockfile tracks the pnpm 12 release line. See Embedded bootstrap artifacts for the focused update procedure.

References: package.json• L3-8 scripts/update-bootstrap.mjs• L8-18 scripts/update-bootstrap.mjs• L21-46 src/…/run.ts• L14-29

Maintenance flow

Source-to-action flow

The source-to-action flow turns runtime source into the file that consuming workflows execute. A maintainer changes the source, runs the bundle build, and commits the resulting dist/index.js. Pull request validation then checks that the generated bundle has no further diff.

The diagram shows how source changes become a validated distributable artifact.

flowchart LR
    S[TypeScript source] --> B[pnpm run build]
    B --> D[dist/index.js]
    D --> R[GitHub Actions runner]
    D --> C[Bundle consistency check]
    C -->|no diff| V[Validated change]
    C -->|diff| F[Stale bundle]

The build command is defined in package.json, and the root pnpm-lock.yaml pins the tools that make the build reproducible. The embedded bootstrap lockfiles are separate from this development dependency lockfile. package.json, pnpm-lock.yaml, .github/…/pr-check.yaml

References: package.json• L3-24 pnpm-lock.yaml• L1-52 .github/…/pr-check.yaml• L12-28 dist/index.js• L1

Bootstrap-to-runner flow

The bootstrap-to-runner flow selects a start package, installs it with npm, and then updates it to the requested pnpm target. The selected command path is added to the runner environment so later workflow steps use the target version. The same target also controls the version-sensitive work such as cache path calculation.

The diagram shows how the three embedded artifacts support one runner setup.

flowchart TD
    I[Action input and workspace manifest] --> T[Target pnpm version]
    T --> S{Target and runner}
    S -->|pnpm 12| N[Native bootstrap lockfile]
    S -->|Older target and old Node or standalone| E[Executable bootstrap lockfile]
    S -->|Older target and compatible Node| P[Normal bootstrap lockfile]
    N --> A[npm bootstrap install]
    E --> A
    P --> A
    A --> U[Target-version update]
    U --> H[Runner PATH and outputs]
    H --> W[Workflow pnpm commands]

The action's cross-platform checks cover the selection and handoff contract. See Continuous validation for the validation matrix and its failure signals.

References: src/…/run.ts• L37-55 src/…/run.ts• L75-127 .github/…/test.yaml• L10-81 .github/…/test.yaml• L168-243 .github/…/test.yaml• L245-291

Change checklist

When these files or sections are changed, remember to consider these:

  • When changing the action contract or its entry point, rebuild dist/index.js and confirm that the main and post phases still share their saved state.
  • When changing the legacy bootstrap version, regenerate both pnpm-lock.json and exe-lock.json from the same version.
  • When changing the pnpm 12 bootstrap version, regenerate native-lock.json and confirm that native selection still covers the intended target range.
  • When changing scripts/update-bootstrap.mjs, check both positional version arguments and their npm dist-tag fallbacks. A change can update one bootstrap family while leaving another stale.
  • When changing target-version selection or bootstrap paths, check that the selected pnpm version and the version used for cache paths remain the same.
  • When changing build tools or the runtime target, check package.json, pnpm-lock.yaml, action metadata, and the pull request bundle check together.

Important failure modes

TriggerConsequenceGuard
dist/index.js is not rebuilt after a source changeConsumers run old behavior even when the source is correctThe pull request check builds the bundle and requires no diff in dist/index.js
pnpm-lock.json and exe-lock.json use different legacy versionsNormal and standalone runners start from different pnpm releasesupdate-bootstrap writes both from the same legacy version argument
native-lock.json is refreshed with the wrong major linepnpm 12 selection can start from a package that does not support the intended targetThe refresh command has a separate native version and the runtime selects native targets explicitly
The requested version conflicts with the workspace manifest pinThe action stops instead of choosing an unclear versionTarget-version selection rejects two different explicit versions
The bootstrap version differs from the version used for project workCache store paths can differ and later cache steps can failThe action updates the bootstrap to the selected target before it reports the command path
A bootstrap package needs install-time setup but its lockfile or package metadata does not allow itnpm completes an incomplete bootstrap or the command is not usableThe generated lockfiles and bootstrap package metadata preserve the package install contract

Key files

FileWhy to read it
action.ymlDefines the public action inputs, outputs, runtime, and main/post entry points.
src/index.tsShows the high-level main and post phases that the bundle must preserve.
src/…/run.tsShows how bootstrap selection, target updates, PATH setup, and reported command paths relate.
src/…/pnpm-lock.jsonDefines the normal legacy pnpm bootstrap and its integrity-pinned package.
src/…/exe-lock.jsonDefines the standalone legacy bootstrap and its platform package data.
src/…/native-lock.jsonDefines the native pnpm 12 bootstrap and its platform package data.
scripts/update-bootstrap.mjsDefines how maintainers refresh the legacy and native bootstrap lockfiles.
package.jsonDefines the bundle build and bootstrap refresh commands.
pnpm-lock.yamlPins the repository tools used to build and maintain the distributable bundle.
.github/…/pr-check.yamlEnforces that the checked-in bundle matches the source.
.github/…/test.yamlChecks the user-facing setup and cross-platform regression contracts.
dist/index.jsIs the checked-in entry point that GitHub Actions executes for consumers.