Skip to content

Commit

Permalink
Fix Get-CurrentBranch to always rely on git (and not GITHUB_REF env v…
Browse files Browse the repository at this point in the history
…ariable) (microsoft#950)

Fix `Get-CurrentBranch` to always rely on git (and not GITHUB_REF env
variable)

`$env:GITHUB_REF` is not the same as the checked out branch.
`$env:GITHUB_REF` is the branch the workflow is running on.

Fixes
[AB#525684](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/525684)
  • Loading branch information
mazhelez authored Apr 18, 2024
1 parent 1fcbaee commit 79ee4d0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions build/scripts/EnlistmentHelperFunctions.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ function Get-BuildMode() {
}

function Get-CurrentBranch() {
if ($ENV:GITHUB_REF) {
return $ENV:GITHUB_REF.Replace("refs/heads/", "")
}
return git rev-parse --abbrev-ref HEAD
}

Expand Down Expand Up @@ -327,4 +324,4 @@ function RunAndCheck {
}

Export-ModuleMember -Function *-*
Export-ModuleMember -Function RunAndCheck
Export-ModuleMember -Function RunAndCheck

0 comments on commit 79ee4d0

Please sign in to comment.