Skip to content

Commit b25504b

Browse files
committed
Fix tag build branch resolution matching HEAD alias
The PowerShell script matched 'origin/HEAD -> origin/main' instead of 'origin/main', causing GIT_BRANCH to be set to an invalid value and GitVersion to fail with undefined output on tag builds.
1 parent a376032 commit b25504b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ steps:
3232
if ($sourceBranch.StartsWith("refs/tags/")) {
3333
$tagCommit = git rev-list -n 1 "$sourceBranch"
3434
$containingBranch = git branch -r --contains $tagCommit |
35-
Where-Object { $_ -match 'origin/(main|master)' } |
35+
Where-Object { $_ -notmatch '->' -and $_ -match 'origin/(main|master)' } |
3636
Select-Object -First 1
3737
if ($containingBranch) {
3838
$branchName = $containingBranch.Trim().Replace("origin/", "")

0 commit comments

Comments
 (0)