File tree Expand file tree Collapse file tree 4 files changed +15
-5
lines changed
Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 2121 condition : succeededOrFailed()
2222
2323 - pwsh : |
24- $(Build.SourcesDirectory)/eng/scripts/Validate-TypeSpec.ps1 $(Build.SourcesDirectory)
24+ $(Build.SourcesDirectory)/eng/scripts/Validate-TypeSpec.ps1 $(Build.SourcesDirectory) -GitClean
2525 displayName: Validate All Specs
2626 condition: succeededOrFailed()
Original file line number Diff line number Diff line change 2424 $(Build.SourcesDirectory)/eng/scripts/Validate-TypeSpec.ps1 `
2525 $(Build.SourcesDirectory) `
2626 "origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" `
27- "${env:SYSTEM_PULLREQUEST_SOURCECOMMITID}"
27+ "${env:SYSTEM_PULLREQUEST_SOURCECOMMITID}" `
28+ -GitClean
2829 displayName: Validate Impacted Specs
2930 condition: succeededOrFailed()
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ $allChangedFiles = (Get-ChildItem -path ./specification tspconfig.yaml -Recurse)
1313$allChangedFiles = $allChangedFiles -replace ' \\' , ' /'
1414
1515if ([string ]::IsNullOrEmpty($TargetBranch ) -or [string ]::IsNullOrEmpty($SourceBranch )) {
16+ if ($TargetBranch -or $SourceBranch ) {
17+ throw " Please provide both target branch and source branch."
18+ }
1619 $changedFiles = $allChangedFiles
1720}
1821else {
Original file line number Diff line number Diff line change 55 [Parameter (Position = 1 , Mandatory = $false )]
66 [string ]$TargetBranch ,
77 [Parameter (Position = 2 , Mandatory = $false )]
8- [string ]$SourceBranch
8+ [string ]$SourceBranch ,
9+ [Parameter (Mandatory = $false )]
10+ [switch ]$GitClean
911)
1012
1113$exitCode = 0
@@ -25,8 +27,12 @@ if ($typespecFolders) {
2527 if ($LASTEXITCODE ) {
2628 $exitCode = 1
2729 }
28- git restore .
29- git clean - df
30+ if ($GitClean ) {
31+ Write-Host " git restore ."
32+ git restore .
33+ Write-Host " git clean -df"
34+ git clean - df
35+ }
3036 }
3137}
3238
You can’t perform that action at this time.
0 commit comments