Support Sparse checkouts
Discussed in https://github.com/actions/checkout/discussions/798
Originally posted by devminded May 20, 2022
Support sparse checkouts
Purpose
When using large project with many modules (AKA monorepo) being able to do sparse checkouts (supported since git 2.25.x) would be very helpful.
Example
Repo containing:
- scripts
- tools
- modules/mobile-client
- modules/server
- modules/web
We want to only checkout and build the mobile-client (nice when combined with paths/paths_ignore).
So the equivalent of git sparse-checkout init --cone && git sparse-checkout set modules/mobile-client scripts tools would be:
- name: Checkout tools repo
uses: actions/checkout@v3
with:
repository: my-org/my-repo
sparse:
- modules/mobile-client
- scripts
- tools
Ref: https://github.blog/2020-01-17-bring-your-monorepo-down-to-size-with-sparse-checkout/
Related #172 #680
Worth noting that this https://github.com/actions/checkout/blob/main/src/git-source-provider.ts#L188 causes all LFS files to be retrieved for the given branch.
When using sparse-checkout AND lfs, checkout will only download lfs files as needed so the sparse rules can be used to prevent a lot of stuff being downloaded which is great, but only with the call to git lfs fetch origin ... being removed.
any news on this? I this feature planned to be implemented?
Hey everyone! Good news for those that need this feature, I have created a PR to add sparse-checkout support! 🎉
This Issue has been solved! https://github.com/actions/checkout/pull/1369
This can probably be closed? @TingluoHuang
Thank you very much team.