Skip to content

Commit 3cdd31d

Browse files
azure-sdksima-zhu
andauthored
Preprocess the target branch + Remove deleted files (Azure#23000)
Co-authored-by: sima-zhu <[email protected]>
1 parent f6a326b commit 3cdd31d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

eng/common/pipelines/templates/steps/credscan.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ parameters:
77
steps:
88
- pwsh: |
99
if ("$(Build.Reason)" -eq 'PullRequest') {
10-
(git diff "origin/$(System.PullRequest.TargetBranch)" HEAD --name-only)
11-
| ForEach-Object { Add-Content -Path "${{ parameters.SourceDirectory }}/credscan.tsv" -Value "${{ parameters.SourceDirectory }}/$_"}
10+
$targetBranch = "origin/$(System.PullRequest.TargetBranch)" -replace "/refs/heads/"
11+
$changedFiles = git diff $targetBranch HEAD --name-only --diff-filter=d
12+
$changedFiles | ForEach-Object { Add-Content -Path "${{ parameters.SourceDirectory }}/credscan.tsv" -Value "${{ parameters.SourceDirectory }}/$_"}
1213
}
1314
else {
1415
Set-Content "${{ parameters.SourceDirectory }}/credscan.tsv" -Value "${{ parameters.SourceDirectory }}/sdk/${{ parameters.ServiceDirectory }}"

0 commit comments

Comments
 (0)