checkout icon indicating copy to clipboard operation
checkout copied to clipboard

Support Sparse checkouts

Open devminded opened this issue 3 years ago • 2 comments

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/

devminded avatar May 21 '22 10:05 devminded

Related #172 #680

devminded avatar May 21 '22 10:05 devminded

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.

mversluys avatar Aug 02 '22 15:08 mversluys

any news on this? I this feature planned to be implemented?

KIC avatar Mar 17 '23 17:03 KIC

Hey everyone! Good news for those that need this feature, I have created a PR to add sparse-checkout support! 🎉

dfdez avatar May 13 '23 11:05 dfdez

This Issue has been solved! https://github.com/actions/checkout/pull/1369

dfdez avatar Jun 10 '23 00:06 dfdez

This can probably be closed? @TingluoHuang

tamird avatar Aug 02 '23 15:08 tamird

Thank you very much team.

devminded avatar Aug 04 '23 07:08 devminded