checkout
checkout copied to clipboard
sparse-checkout not working when running in a container.
I'm using actions/checkout@v4 Sparce checkout parameter doesn't have any effect when running job in a container.
It works fine when running directly on an ubuntu self-hosted runner. But when I tried running using debian or alpine image, it checks out the entire repo.
My guess that it has to do with Git being present in the container.
The logs for Alpine/Debian containers look like this:
Getting Git version info
Deleting the contents of '/__w/my-repo/my-repo'
The repository will be downloaded using the GitHub REST API
To create a local Git repository instead, add Git 2.18 or higher to the PATH
Downloading the archive
Writing archive to disk
Extracting the archive
<extracting using tar>
Resolved version <my-repo>
Logs when using a runner directly:
Getting Git version info
Temporarily overriding HOME='/runner/_work/_temp/guid' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add safe.directory /runner/_work/my-repo/my-repo
Deleting the contents of '/runner/_work/my-repo/my-repo'
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Fetching the repository
Determining the checkout info
Setting up sparse checkout
Checking out the ref
/usr/bin/git log -1 --format='%H