You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
nuryupin-kr
changed the title
sparse-checkout not working when using container.
sparse-checkout not working when running in a container.
Feb 2, 2024
I'm facing the same problem. It isn't working inside a container image; it shows the entire repository. However, it's working fine if I don't use a container.
name: AzurePowerShellScripton: [workflow_dispatch]jobs:
Resources:
runs-on: ubuntu-latest container: mcr.microsoft.com/azure-powershell:latest steps:
- name: Check Outuses: actions/checkout@v4 with:
sparse-checkout-cone-mode: falsesparse-checkout: | GHActionTest/ 3TierApp/
- name: TestStepshell: pwshrun: Get-ChildItem -Recurse #Shows only checked out repo. contents when not using the container image.
Is sparse-checkout expected to work inside containers? Could this be a Git version\configuration mismatch with the image?
Setting a variable in $Env:GITHUB_OUTPUT and retrieving it in another job also doesn't work when using a container image. I'm not sure if that's related or if it should be a separate issue.
I also encountered this problem.
After I looked at the implementation of actions/checkout, I found that sparse-checkout needs the git version newer than 2.28, then i tried to upgrade the git version to latest, it worked well
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:
Logs when using a runner directly:
The text was updated successfully, but these errors were encountered: