feat(actions): per-ecosystem free-disk-space actions for hosted runners - #4
Merged
Conversation
Add a separate node_modules cache (exact lockfile-hash key, no fuzzy fallback) to restore_npm_cache/save_npm_cache, and skip 'npm ci' in the npm action on an exact hit. 'npm ci' wipes node_modules and reinstalls, so caching it only pays off paired with skipping the reinstall, saving ~2 min per run when the lockfile is unchanged. A miss falls back to 'npm ci', so it is always safe.
This was referenced Aug 12, 2026
goastler
marked this pull request as ready for review
August 12, 2026 13:50
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.
GitHub-hosted runners ship with ~30 GB of preinstalled toolchains and only ~14 GB free. That is what killed Protect#410 on hosted:
aws-lc-sysfailed withar: … No space left on devicein a PR that contained no Rust at all.jlumbroso/free-disk-spaceis the usual answer, but it is monolithic — you either take all of its deletions or configure it with a wall of booleans, and the ones you don't need still cost minutes (the apt purge alone is slow). Here each ecosystem is its own composite action, so a workflow asks for exactly what it can spare:free_disk_space_android/usr/local/lib/android— ~9 GBfree_disk_space_tool_cache/opt/hostedtoolcache— ~10 GBfree_disk_space_haskell/opt/ghc,.ghcup, CodeQL — ~5 GBfree_disk_space_dockerfree_disk_space_swapfree_disk_space_dotnet/usr/share/dotnet— ~2 GBfree_disk_space_swift/usr/share/swift— ~2 GBfree_disk_space_aptEach prints freed MB and remaining GB so a workflow that later hits ENOSPC has the numbers in its log.
Every step is guarded on
runner.environment != 'self-hosted'. The fleet is non-ephemeral, so a deletion there is permanent and hits every later job on that host. The guard sits in the action rather than in the caller so it cannot be forgotten.Two caveats, both documented inline:
tool_cachemust run before anyactions/setup-*step or the version it wants is re-downloaded, anddockerprunes every image, so it belongs before anything is built or pulled.