Skip to content

Commit

Permalink
Update a string value in Get PR Changed Files Script (#26637)
Browse files Browse the repository at this point in the history
* Update get-pr-changed-files.yml

* Update get-pr-changed-files.yml
  • Loading branch information
YanaXu authored Nov 8, 2024
1 parent 58b9abd commit 8dce41c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .azure-pipelines/util/get-pr-changed-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ steps:
script: |
# refer to https://learn.microsoft.com/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#system-variables-devops-services
# get the target branch name
$targetBranch = $(System.PullRequest.TargetBranch)
$targetBranch = "$(System.PullRequest.TargetBranch)"
# fetch the targetBranch from origin to local branch and rename the branch to 'origin/base'
git fetch --no-tags origin "${targetBranch}:origin/base"
# refer to https://git-scm.com/docs/git-diff
# compare the pr and targetBranch branch, get the changed file list
# diff-filter options are ACMRT, which are: Added, Copied, Modified, Renamed , Changed
$changedFiles = git --no-pager diff --name-only --diff-filter=ACMRT origin/base -- .
# diff-filter options are ACDMRT, which are: Added, Copied, Deleted, Modified, Renamed, Changed
$changedFiles = git --no-pager diff --name-only --diff-filter=ACDMRT origin/base -- .
Write-Host "Total updated files:" $changedFiles.Count
Write-Host "All Updated files:"
$changedFiles | Foreach-Object {Write-Host $_}
Expand Down

0 comments on commit 8dce41c

Please sign in to comment.