Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparscheckout breaks cached repository #1992

Open
imarinov3 opened this issue Nov 28, 2024 · 2 comments
Open

Sparscheckout breaks cached repository #1992

imarinov3 opened this issue Nov 28, 2024 · 2 comments

Comments

@imarinov3
Copy link

When we use sparsecheckout in some job, the next jobs continue to use sparscheckout.

- uses: actions/checkout@v4
      with:
        ref: ${{ github.event.pull_request.base.ref }}
        sparse-checkout-cone-mode: false
        sparse-checkout: |
          .github/

After this job finishes any other job that runs on the same machine using normal checkout preserves the sparse option.

- uses: actions/checkout@v4

We run into this issue when running multiple jobs while only one of those have sparse checkout. All jobs are from the same repository.

In the logs we see that the second job executes git sparse-checkout disable (during checkout), but this command does not seem to take effect. We still see the sparseCheckout = true option if we look inside the .git/config of the repo.

@valentinvarbanov
Copy link

valentinvarbanov commented Nov 28, 2024

Old issue that claims to fix the problem #1475, probably doesn't fully resolve it.

@velll
Copy link

velll commented Dec 11, 2024

I've just hit the same issue on the project I'm working on. Had to disable the sparse-checkout manually and pull the repo once more to fix it.

One workaround-ish suggestion I would share — make sure to specify path when pulling with sparse-checkout.

When path is not specified, the runner simply pulls the repo in its _work directory. And if you checkout over and over again, the runner is reusing that repository. This is fine (and maybe even desirable) when pulling the entire repo.

But if are using sparse-checkout, it's likely that you want to save on downloads. Also it's not likely that you are interested in reusing the repo. By manually specifying the path for the sparsely-checked-out repo I avoid breaking the repo in the working directory of the runner. Awkward, but works.

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

No branches or pull requests

3 participants