Speed-up Nx GitHub Actions by avoiding fetching entire git history #31797
kopach
started this conversation in
Show and Tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background / Motivation
Nx docs and starter workflows currently suggest fetching entire git history every time:
For large, long-lived monorepos, this step alone can add some time to every CI run because it clones the full commit history and all tags.
Yet
nx affected
only needs (correct me if I'm wrong here):The current commit (already available with default checkout depth 1).
A single base commit (e.g.
origin/main
) to diff against.Fetching the entire DAG is overkill in 99 % of PR builds.
Proposed usage/change
Replace
fetch-depth: 0
with the default shallow clone (depth 1) plus one extra shallow fetch for the base branch:Then run Nx:
Please let me know what do you think and whether my assumptions are correct also for corner cases
Beta Was this translation helpful? Give feedback.
All reactions