Skip to content

Use @actions/tool-cache to manage pnpm versions instead of forcing download #269

Open

Description

@GregoireW

Github action did have a process to manage tooling: https://github.com/actions/toolkit/tree/main/packages/tool-cache you can find a tool version before download and install. On self hosted runner, if you already have the tool in the cache, it means it is wwwaaayyyyy faster to setup.

Is there plan to support this ?

thank you

Activity

  1. cschanhniem commented on Jun 19, 2026

    @cschanhniem

    I looked at the current install approach in src/install-pnpm/run.ts. The bootstrap mechanism uses committed lockfiles (pnpm-lock.json + exe-lock.json) for supply chain integrity — npm resolves every dependency against those pinned hashes, so there is no opportunity for a package registry compromise to inject bad code.

    Switching to @actions/tool-cache would replace that with a download-and-cache approach. The trade-offs:

    • Performance: on self-hosted runners with cold caches, tool-cache's download is similar to npm ci. On GitHub-hosted runners the npm bootstrap cache is already warm from every prior run. On self-hosted runners with a warm tool-cache, tool-cache skips the download entirely — this is the one real win.

    • Security: tool-cache does not have a built-in integrity-verified bootstrap chain. You would need to verify checksums yourself, and the current lockfile approach cannot be replicated with tool-cache.

    • Version resolution: the current readTargetVersion logic (packageManager, devEngines, version input) would still work, but self-update becomes unnecessary since tool-cache extracts the right version directly.

    The biggest practical benefit would be eliminating the bootstrap-layer complexity — no more committed lockfiles, no self-update step, no bootstrap pnpm at all. The risk is losing the integrity guarantees unless checksums are verified manually. If that trade-off is acceptable, the cleanest approach would be to download the pnpm standalone binary from the registry and verify its shasum inline.

  2. etaMS20 commented on Oct 22, 2026

    @etaMS20

    +1 from a team on self-hosted runners with pnpm 12. Since packageManager pins an exact version, the bootstrap (12.3.4 in v6.1.0) never matches, so every job runs self-update to 12.10.1.

    On warm runners that's ~3.5 s, but in a job container where nothing persists it was ~17.6 s per job. With a sharded matrix we pay that once per shard.

    Could the verified bootstrap + self-update stay the only way pnpm gets installed, with the result cached via @actions/tool-cache by exact version? The first job on a runner would still be fully verified, and later jobs would skip the download.

  3. threeal commented on Nov 10, 2026

    @threeal

    I don't mean to endorse this, but while this action still not using RUNNER_TOOL_CACHE, you can try this action instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions