Set multiple sparse checkout paths in one command/job (#2169)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
This commit is contained in:
parent
61e3dae352
commit
ead97d476b
@ -24,15 +24,13 @@ steps:
|
||||
- pwsh: |
|
||||
git clone --no-checkout --filter=tree:0 git://github.com/${{ repo.Name }} .
|
||||
git sparse-checkout init
|
||||
git sparse-checkout set eng
|
||||
$paths = ('${{ convertToJson(parameters.Paths) }}' | ConvertFrom-Json) -Join ' '
|
||||
Invoke-Expression -Command "git sparse-checkout set eng $paths"
|
||||
Write-Host "Set sparse checkout paths to:"
|
||||
Get-Content .git/info/sparse-checkout
|
||||
displayName: Init sparse checkout ${{ repo.Name }}
|
||||
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}
|
||||
|
||||
- ${{ each path in parameters.Paths }}:
|
||||
- pwsh: git sparse-checkout add ${{ path }}
|
||||
displayName: Add sparse checkout path ${{ path }}
|
||||
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}
|
||||
|
||||
- pwsh: git checkout ${{ repo.Commitish }}
|
||||
displayName: Sparse checkout at ${{ repo.Commitish }}
|
||||
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user