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
When trying to checkout single file from root of remote repo, the sparse-checkout option appears to be pulling all files from that branch.
- uses: actions/checkout@v4with:
# Repository name with owner. For example, actions/checkout# Default: ${{ github.repository }}repository: 'GEO-BON/bon-in-a-box-pipeline-engine.git'# The branch, tag or SHA to checkout. When checking out the repository that# triggered a workflow, this defaults to the reference or SHA for that event.# Otherwise, uses the default branch.ref: 'pipeline-repo-actions'# Relative path under $GITHUB_WORKSPACE to place the repositorypath: '.server'# Do a sparse checkout on given patterns. Each pattern should be separated with# new lines.# Default: nullsparse-checkout: | prod-server.sh
- name: Tempworking-directory: .run: ls -la .servershell: bash
I would expect that the ls above will show only one file plus .git folder. Instead, we get the following:
Run ls -la .server
total 92
drwxr-xr-x 3 runner docker 4096 Nov 17 19:22 .
drwxr-xr-x 10 runner docker 4096 Nov 17 19:22 ..
-rw-r--r-- 1 runner docker 69 Nov 17 19:22 .dev-paths.env
drwxr-xr-x 8 runner docker 4096 Nov 17 19:22 .git
-rw-r--r-- 1 runner docker 930 Nov 17 19:22 .gitattributes
-rw-r--r-- 1 runner docker 69 Nov 17 19:22 .gitignore
-rw-r--r-- 1 runner docker 61 Nov 17 19:22 .prod-paths.env
-rw-r--r-- 1 runner docker 89 Nov 17 19:22 .test-paths.env
-rw-r--r-- 1 runner docker 1064 Nov 17 19:22 LICENSE
-rw-r--r-- 1 runner docker 6285 Nov 17 19:22 README-dev.md
-rw-r--r-- 1 runner docker 17396 Nov 17 19:22 README-user.md
-rw-r--r-- 1 runner docker 454 Nov 17 19:22 README.md
-rw-r--r-- 1 runner docker 1446 Nov 17 19:22 compose.dev.yml
-rw-r--r-- 1 runner docker 517 Nov 17 19:22 compose.prod.yml
-rw-r--r-- 1 runner docker 2480 Nov 17 19:22 compose.yml
-rwxr-xr-x 1 runner docker 486 Nov 17 19:22 dev-server.sh
-rwxr-xr-x 1 runner docker 5290 Nov 17 19:22 prod-server.sh
Note that the above gives the same result with sparse-checkout: 'prod-server.sh'.
The text was updated successfully, but these errors were encountered:
Looking at the actions/checkoutdocumentation, you need to specify sparse-checkout-cone-mode: false if you only want to check-out a single file.
Thanks for the link! It's indeed very clear in this example. However, in the documentation of the parameters themselves, nothing states that sparse-checkout cannot be used on its own.
# Do a sparse checkout on given patterns. Each pattern should be separated with
# new lines.
# Default: null
sparse-checkout: ''
# Specifies whether to use cone-mode when doing a sparse checkout.
# Default: true
sparse-checkout-cone-mode: ''
I would expect either sparse checkout to automatically trigger that option, or that it be explicitly documented in the parameter description.
When trying to checkout single file from root of remote repo, the sparse-checkout option appears to be pulling all files from that branch.
I would expect that the
ls
above will show only one file plus .git folder. Instead, we get the following:Note that the above gives the same result with
sparse-checkout: 'prod-server.sh'
.The text was updated successfully, but these errors were encountered: