Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit ec8533e

Browse files
authored
Merge pull request #651 from xamarin/dev/fix-non-pr
Fix the case where variables do not exist (attempt 2)
2 parents c1715e1 + ad47684 commit ec8533e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

azure-pipelines.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
displayName: 'Prepare for builds'
2525
variables:
2626
skipComponentGovernanceDetection: true
27-
prTargetBranch: '$(System.PullRequest.TargetBranch)' # does not exist on non-PR builds
2827
pool:
2928
name: Hosted Ubuntu 1604
3029
steps:
@@ -36,7 +35,10 @@ jobs:
3635
Write-Host "Master branch: $masterBranch"
3736
3837
# determine the "current" branch
39-
$branch = if ("$(prTargetBranch)") { "$(prTargetBranch)" } else { "$(Build.SourceBranchName)" }
38+
$branch = "$(Build.SourceBranchName)"
39+
if ("$env:SYSTEM_PULLREQUEST_TARGETBRANCH") {
40+
$branch = "$env:SYSTEM_PULLREQUEST_TARGETBRANCH"
41+
}
4042
Write-Host "Current branch: $branch"
4143
4244
if ($branch -eq $masterBranch) {

0 commit comments

Comments
 (0)