Skip to content

Commit

Permalink
Preprocess the target branch + Remove deleted files (#17030)
Browse files Browse the repository at this point in the history
Co-authored-by: sima-zhu <sizhu@microsoft.com>
  • Loading branch information
azure-sdk and sima-zhu committed Feb 10, 2022
1 parent 2bb27d4 commit a616d27
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions eng/common/pipelines/templates/steps/credscan.yml
Expand Up @@ -7,8 +7,9 @@ parameters:
steps:
- pwsh: |
if ("$(Build.Reason)" -eq 'PullRequest') {
(git diff "origin/$(System.PullRequest.TargetBranch)" HEAD --name-only)
| ForEach-Object { Add-Content -Path "${{ parameters.SourceDirectory }}/credscan.tsv" -Value "${{ parameters.SourceDirectory }}/$_"}
$targetBranch = "origin/$(System.PullRequest.TargetBranch)" -replace "/refs/heads/"
$changedFiles = git diff $targetBranch HEAD --name-only --diff-filter=d
$changedFiles | ForEach-Object { Add-Content -Path "${{ parameters.SourceDirectory }}/credscan.tsv" -Value "${{ parameters.SourceDirectory }}/$_"}
}
else {
Set-Content "${{ parameters.SourceDirectory }}/credscan.tsv" -Value "${{ parameters.SourceDirectory }}/sdk/${{ parameters.ServiceDirectory }}"
Expand Down

0 comments on commit a616d27

Please sign in to comment.