ci: Adjust stage-determine-changes.yml

This commit is contained in:
Youssef Victor 2024-04-08 15:29:30 +02:00 коммит произвёл GitHub
Родитель aab5b0d108
Коммит 433aee6ef9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@ -6,11 +6,10 @@ jobs:
steps: steps:
- powershell: | - powershell: |
# Determine the context of the build (PR or push) and set the target branch accordingly # Determine the context of the build (PR or push) and set the target branch accordingly
$prTargetBranch = "$(System.PullRequest.TargetBranch)" $isPR = "$(Build.Reason)" -eq "PullRequest"
$isPR = -not [string]::IsNullOrWhiteSpace($prTargetBranch)
# Normalize the target branch name for PR builds or default to 'master' for push builds # Normalize the target branch name for PR builds or default to 'master' for push builds
$targetBranchName = $isPR ? $prTargetBranch -replace 'refs/heads/', '' : "master" $targetBranchName = $isPR ? "$(System.PullRequest.TargetBranch)" -replace 'refs/heads/', '' : "master"
Write-Host "Build context determined: $(if ($isPR) { 'Pull Request targeting ' + $targetBranchName } else { 'Push' })" Write-Host "Build context determined: $(if ($isPR) { 'Pull Request targeting ' + $targetBranchName } else { 'Push' })"
# Fetch the target or default base branch and determine the merge base # Fetch the target or default base branch and determine the merge base