Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a lockfile hash miss, the dependency cache restores the newest cache for the same OS and architecture via restore keys, and nothing ever prunes that store. Each lockfile change restores the previous store, the install adds the new packages, and the post step saves the combined store under the new key. Without a cache size limit or a short retention, the store keeps growing.
In langgenius/dify, on Depot runners (Depot's cache is shared by every branch, keeps entries for 14 days, and has no size limit by default), the Linux pnpm store grew to 3.4 GB. A fresh store for the same lockfile is about 385 MB. Restoring it took a median 18s and up to 109s across 237 jobs, while
vp installtook 2–3s. That added up to roughly 50–75 runner-minutes in 17 hours.This adds an opt-in
cache-pruneinput. When it istrueand a pnpm cache came from a restore key, the post step runsvp pm cache clean(pnpm store prune) before saving, so the saved store keeps only the packages installs on the runner use. Restore-key restores still save download time.It is off by default because pruning depends on what the job installed: after
run-install: false, a--prodinstall or a--filterinstall, prune removes packages the lock file still needs. The README says to enable it only in jobs that install every package in the lock file.The action skips the prune unless
vp env current --jsonreports pnpm 12.16.0 or later. Before 12.16.0,pnpm store prunealso removed packages that pnpm copied or cloned intonode_modules, which includespackageImportMethod: copyand macOS's default clone (12.16.0 release notes). If pruning fails, the store is saved unpruned. npm, yarn and bun are unchanged.I ran the built post step against a temp project with pnpm 12.21.0 and a dependency removed after install:
cache-prunefalse(default)true