Set multiple sparse checkout paths in one command/job (#2169)

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
This commit is contained in:
Azure SDK Bot 2021-04-29 10:23:33 -07:00 committed by GitHub
parent 61e3dae352
commit ead97d476b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)) }}