Action inputs and install configuration
The action converts GitHub Actions inputs into one normalized configuration for the run. This configuration selects the pnpm version and storage paths, controls cache use, and turns run_install into ordered install requests for the runtime. The main lifecycle then passes the same values to action runtime orchestration, pnpm provisioning, cache restoration, and dependency installation.
Input contract
The public input contract is defined in home/…/action.yml. All inputs are optional at the workflow level. Defaults provide safe behavior for storage, caching, lockfile lookup, manifest lookup, and standalone mode.
Provisioning inputs
The provisioning inputs tell the action which pnpm version to use and where to keep its files. version has no metadata default, so the provisioning stage can read a project declaration when the workflow does not provide one. package_json_file selects that declaration and defaults to package.json.
| Input | Default | Normalized value | Purpose |
|---|---|---|---|
version | none | Optional version string | Selects the requested pnpm version. An empty value leaves selection to the project manifest. |
dest | ~/setup-pnpm | Expanded path string | Selects the pnpm storage directory. |
package_json_file | package.json | Expanded path string | Selects the workspace-relative manifest used for pnpm version discovery. |
standalone | false | Boolean | Requests the pnpm package that includes its own Node.js runtime. |
The version source and standalone choice affect the later pnpm provisioning stage. This page describes how the values enter the shared configuration; that page describes how provisioning uses them.
References: action.yml• L7-13 action.yml• L26-33 src/…/index.ts• L5-12 src/…/index.ts• L21-29
Cache inputs
The cache inputs control whether the action restores and later saves the pnpm store. cache_dependency_path identifies the files whose contents represent the dependency state. It defaults to pnpm-lock.yaml and accepts multiple paths separated by newlines.
| Input | Default | Normalized value | Purpose |
|---|---|---|---|
cache | false | Boolean | Enables the store cache lifecycle when true. |
cache_dependency_path | pnpm-lock.yaml | Expanded path string | Supplies dependency files to cache-key hashing. |
The normalized cache flag is read by the runtime before restoration. The normalized path is passed to the hashing step, which means a missing or empty match can stop cache restoration. See cache restoration and cache persistence for the cache lifecycle.
References: action.yml• L18-25 src/…/index.ts• L8-10 src/…/index.ts• L21-28 src/…/run.ts• L8-19
Input normalization
The input layer reads values through GitHub Actions' input helpers and produces an Inputs object. Downstream stages use this object instead of reading workflow inputs again, so parsing and default handling occur at one boundary.
Path and boolean normalization
Path inputs pass through tilde expansion before they enter the shared configuration. This turns the default ~/setup-pnpm into a concrete home-directory path and applies the same rule to the cache and manifest paths. Boolean inputs use GitHub Actions boolean parsing, so invalid boolean text is rejected instead of silently becoming false.
The normalized configuration contains these fields:
version: an optional version string.dest: the expanded pnpm storage path.cache: the cache enable flag.cacheDependencyPath: the expanded dependency-file path value.runInstall: an array of validated install requests.packageJsonFile: the expanded manifest path.standalone: the standalone-mode flag.
package_json_file remains a path relative to GITHUB_WORKSPACE when provisioning reads the manifest. Path expansion does not change that workspace contract.
References: src/…/index.ts• L1-19 src/…/index.ts• L21-29 src/…/run.ts• L108-129
Run-install request model
run_install is a YAML value carried in the action input. The parser accepts no install request, one simple boolean request, one object, or a list of objects. It converts each accepted form into the same RunInstall[] array used by the install runner.
| Input form | Normalized result | Runtime meaning |
|---|---|---|
null or false | [] | Do not run dependency installation. |
true | [{ recursive: true }] | Run one recursive install. |
| One object | One-element request array | Run one configured install. |
| Object list | The same request list | Run each configured install in input order. |
Each request can define recursive, cwd, and args:
recursiveselectspnpm recursive installinstead ofpnpm install.cwdselects the working directory for that request.argsadds pnpm arguments after the install operation.
The parser validates the YAML shape and field types before the main lifecycle saves state or starts provisioning. Invalid YAML or an unsupported shape reports the input error and exits the action. The dependency installation page covers how the resulting requests become commands.
References: action.yml• L14-17 src/…/run-install.ts• L5-16 src/…/run-install.ts• L21-40 src/…/index.ts• L5-12
Runtime configuration
The normalized object links public inputs to the action stages. The main phase saves it for the post phase, then passes it to provisioning, output publication, cache restoration, and install execution. The post phase reuses it to decide whether store pruning is needed.
Configuration handoff
This diagram shows how input values become shared run configuration and then control the main and post phases.
flowchart TD
A[Workflow inputs] --> B[Parse paths, booleans, and YAML]
B --> C[Normalized Inputs]
C --> D[Select and expose pnpm]
C --> E[Restore store when cache is enabled]
C --> F[Run ordered install requests]
C --> G[Post phase: prune when installs exist]
E --> H[Save cache using restored state]
The same runInstall array has two effects. It controls whether the main phase runs dependency commands, and it controls whether the post phase attempts pnpm store prune. A configuration change to install requests therefore affects both dependency work and cache cleanup. The cache flag controls restoration and persistence, while dest, version, packageJsonFile, and standalone primarily affect provisioning.
References: src/index.ts• L18-37 src/…/index.ts• L7-16 src/…/index.ts• L5-37 src/…/index.ts• L5-17 src/…/run.ts• L4-17
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the names and defaults in action.yml aligned with the fields read by
getInputs. - When changing a path input, check both tilde expansion and the later workspace-relative manifest or dependency-file contract.
- When changing
run_installforms, update the schema, normalization rules, command assembly, and post-phase prune condition together. - When changing cache inputs, check the hash input and the exact-key decision used by cache restoration and persistence.
- When adding an input, pass it through the shared
Inputstype before adding behavior in a runtime stage. - When changing version-related inputs, keep the conflict and fallback rules in manifest-based version selection aligned with the normalized value.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A boolean input contains text outside the accepted GitHub Actions boolean forms. | Input normalization fails before provisioning begins. | Use true or false values in the action configuration. |
run_install contains invalid YAML or a field with the wrong type. | The parser reports the input error and exits before the main run starts. | Use null, false, true, one request object, or a list of valid request objects. |
package_json_file points outside the checked-out workspace or to a missing manifest while no version is set. | Provisioning cannot find a pnpm version and fails. | Check out the repository first and use a workspace-relative manifest path, or set version. |
cache is true but cache_dependency_path matches no files. | Cache restoration throws before dependency installation. | Point the input at lockfiles that exist in the workspace. |
| An install list is changed from non-empty to empty. | Dependency installation and post-phase store pruning are both skipped. | Check whether the workflow still needs installation and cache cleanup after changing the input. |
Key files
| File | Why to read it |
|---|---|
| action.yml | Defines the public inputs, defaults, and action phases. |
| src/…/index.ts | Builds the normalized configuration shared by all runtime stages. |
| src/…/run-install.ts | Defines accepted run_install values and their array form. |
| src/index.ts | Shows when configuration is saved and which stages consume it. |
| src/…/run.ts | Uses version and manifest settings to select the pnpm target. |
| src/…/index.ts | Converts normalized install requests into pnpm commands. |
| src/…/run.ts | Uses the normalized cache path to compute and restore the store cache. |
| src/…/index.ts | Uses the normalized install list to decide whether cleanup runs. |
| src/…/run.ts | Shows how post-phase state controls cache persistence. |