Dependency installation
Dependency installation turns the run_install action input into one or more pnpm commands. It runs those commands after pnpm is ready and after optional store recovery, so the workflow can install dependencies in the requested project locations with the requested pnpm options. This phase belongs to the action runtime and connects input parsing with cache restoration and cache persistence.
Install configuration
Run-install requests
The run_install input is the control for dependency work. An empty value or false means that the action does not run an install. A true value requests one recursive install. An object or a list of objects gives the action one or more install requests with optional working directories and pnpm arguments.
The action validates this input before the main run starts. Each request can contain:
recursive: runs the install across the workspace.cwd: selects the directory in which pnpm runs.args: adds pnpm arguments after the install operation.
References: action.yml• L14-17 src/…/run-install.ts• L5-16 src/…/run-install.ts• L21-39
Install command execution
Command assembly
The install runner builds each command from the same base operation: pnpm install. It adds the recursive selector when requested and then appends the request's extra arguments. This keeps the input model focused on install intent while preserving pnpm's command options.
For example, a request with recursive: true and args: ["--frozen-lockfile"] becomes the equivalent of pnpm recursive install --frozen-lockfile. The command runs in the request's cwd when one is provided.
References: src/…/index.ts• L5-12 src/…/index.ts• L20-24
Sequential install flow
The runner processes requests in their input order. It starts a log group for each command, runs pnpm with the selected environment, and then checks the process result before moving to the next request.
This diagram shows how configured requests move from input parsing to command execution.
flowchart TD
A[Parse run_install] --> B{Install requests present?}
B -- No --> C[Skip dependency installation]
B -- Yes --> D[Build first pnpm command]
D --> E[Run command in requested directory]
E --> F{Command succeeds?}
F -- Yes --> G{More requests?}
F -- No --> H[Mark action failed]
H --> G
G -- Yes --> D
G -- No --> I[Finish install phase]
References: src/index.ts• L18-31 src/…/index.ts• L5-37
Execution boundaries
Provisioning precondition
Dependency installation starts only after pnpm provisioning returns a usable command location. Provisioning selects a target version from the action settings or the workspace package manager settings. It can use a native pnpm package for pnpm 12 and selects a compatible bootstrap path for older targets and the available Node version. The committed bootstrap lockfiles pin these initial packages and their integrity data.
If provisioning fails, the main phase reports the failure and stops before it restores the cache or runs any install request. When installation does run, the inherited process environment resolves the requested pnpm version rather than the bootstrap copy.
References: src/index.ts• L18-30 src/…/index.ts• L7-16 src/…/run.ts• L38-55 src/…/run.ts• L102-128 src/…/exe-lock.json• L5-15 src/…/native-lock.json• L5-18 src/…/pnpm-lock.json• L5-15 src/…/index.ts• L14-24
Cache independence
Cache restoration happens before installation when caching is enabled, but it does not decide whether installation runs. A cache miss or an older cache match still allows pnpm to resolve missing packages from its configured sources. The install decision comes from the parsed run_install requests.
References: src/index.ts• L23-30 src/…/index.ts• L6-17 src/…/run.ts• L27-40
Command failure handling
The runner marks the action as failed when pnpm cannot start or exits with a non-zero status. It still continues through later requests, so a list of install requests is attempted in order even when an earlier request fails. The failure message identifies the assembled command and its working directory when pnpm returns a non-zero status.
References: src/…/index.ts• L20-37
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the accepted
run_installshapes aligned between action.yml, the parser, and the normalizedRunInstallvalues. - When changing command assembly, check the position of
recursiveand user arguments because both affect pnpm command meaning. - When changing the install request list, check the post-phase condition in src/…/index.ts because request presence also controls store pruning.
- When changing pnpm provisioning or
PATHsetup, check that install commands resolve the selected pnpm version rather than a bootstrap copy. - When changing bootstrap package versions or lockfiles, keep the generated package metadata and integrity data aligned with the bootstrap path selected for the target version.
- When changing failure handling, check whether later requests still run and whether the action reports the final failure to GitHub Actions.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
run_install contains a value outside the supported null, boolean, object, or object-list forms. | Input parsing exits before dependency installation begins. | Use a supported request shape and valid field types. |
| pnpm provisioning fails because no target version is available or two version sources conflict. | The main phase stops before any install command runs. | Set one pnpm version through the action or workspace settings. |
| A bootstrap lockfile does not match the package metadata used for provisioning. | The bootstrap install can fail before the requested pnpm version is ready. | Keep each committed bootstrap lockfile aligned with its bootstrap package definition. |
| A request uses an invalid working directory or incompatible pnpm arguments. | That request fails and the action is marked failed. Later requests can still be attempted. | Check each request's directory and arguments in the workflow context. |
| A configured install command exits with a non-zero status. | The action records a failure even if subsequent requests complete. | Treat the install list as one action result and inspect the reported command and directory. |
Key files
| File | Why to read it |
|---|---|
| action.yml | Defines the public run_install input and its default behavior. |
| src/…/run-install.ts | Defines the accepted request shapes and their normalized values. |
| src/…/index.ts | Places parsed install requests in the shared action configuration. |
| src/index.ts | Shows when dependency installation runs within the main action phase. |
| src/…/index.ts | Shows command assembly, working-directory use, ordering, and failure reporting. |
| src/…/index.ts | Shows the provisioning result that gates install execution. |
| src/…/run.ts | Shows how the target pnpm version becomes the command found by install execution. |
| src/…/exe-lock.json | Pins the executable bootstrap package used for compatible older-Node paths. |
| src/…/native-lock.json | Pins the native pnpm bootstrap package used for pnpm 12 targets. |
| src/…/pnpm-lock.json | Pins the standard pnpm bootstrap package used when the runner can use it directly. |
| src/…/index.ts | Shows the post-phase relationship between install requests and store cleanup. |