Skip to content

fix: preserve workspace cache across build checkout#6

Merged
tarpanpathak merged 2 commits into
mainfrom
fix/build-preserve-workspace-cache
May 25, 2026
Merged

fix: preserve workspace cache across build checkout#6
tarpanpathak merged 2 commits into
mainfrom
fix/build-preserve-workspace-cache

Conversation

@arnavchachra
Copy link
Copy Markdown
Contributor

Summary

Sets `clean: false` on the internal `actions/checkout` step in `build@v2`.

The default `clean: true` runs `git clean -ffdx` on every checkout, which wipes any build caches a caller restored into the workspace before invoking this action (e.g. `.next/cache`, `.turbo`, `.gradle`). Those caches are saved correctly at the end of the job but never actually read by the build — making caller-side caching a no-op.

Setting `clean: false` keeps a standard fetch + reset behaviour without nuking untracked/gitignored directories, so caller-restored caches survive to the build command.

This is a non-breaking change — callers that don't restore any cache are unaffected.

Test plan

  • Verify a consuming repo that restores a build cache before calling `build@v2` now sees the cache used during the build (not just saved at the end)
  • Verify a consuming repo with no cache steps is unaffected

actions/checkout defaults to clean: true which runs git clean -ffdx,
wiping any caller-restored build caches (e.g. .next/cache) before
the build command runs. Setting clean: false lets callers restore a
cache before invoking this action and have it survive to the build.
@tarpanpathak tarpanpathak merged commit 66bd16a into main May 25, 2026
1 check passed
@tarpanpathak tarpanpathak deleted the fix/build-preserve-workspace-cache branch May 25, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants