@@ -352,12 +352,16 @@ function Get-CurrentBuildKind
352352 $currentBuildKind = [BuildKind ]::LocalBuild
353353
354354 # IsAutomatedBuild is the top level gate (e.g. if it is false, all the others must be false)
355- $isAutomatedBuild = $env: CI `
356- -or $env: APPVEYOR `
357- -or $env: GITHUB_ACTIONS
355+ $isAutomatedBuild = [ System.Convert ]::ToBoolean( $env: CI ) `
356+ -or [ System.Convert ]::ToBoolean( $env: APPVEYOR ) `
357+ -or [ System.Convert ]::ToBoolean( $env: GITHUB_ACTIONS )
358358
359359 if ( $isAutomatedBuild )
360360 {
361+ # PR and release builds have externally detected indicators that are tested
362+ # below, so default to a CiBuild (e.g. not a PR, And not a RELEASE)
363+ $currentBuildKind = [BuildKind ]::CiBuild
364+
361365 # IsPullRequestBuild indicates an automated buddy build and should not be trusted
362366 $isPullRequestBuild = $env: GITHUB_BASE_REF -or $env: APPVEYOR_PULL_REQUEST_NUMBER
363367
@@ -367,11 +371,11 @@ function Get-CurrentBuildKind
367371 }
368372 else
369373 {
370- if ($env: APPVEYOR )
374+ if ([ System.Convert ]::ToBoolean( $env: APPVEYOR ) )
371375 {
372376 $isReleaseBuild = $env: APPVEYOR_REPO_TAG
373377 }
374- elseif ($env: GITHUB_ACTIONS )
378+ elseif ([ System.Convert ]::ToBoolean( $env: GITHUB_ACTIONS ) )
375379 {
376380 $isReleaseBuild = $env: GITHUB_REF -like ' refs/tags/*'
377381 }
@@ -450,6 +454,7 @@ function Initialize-BuildEnvironment
450454
451455 Write-Information " MSBUILD:`n $ ( $msbuild | Format-Table - AutoSize | Out-String ) "
452456 Write-Information (dir env:Is* | Format-Table - Property Name, value | Out-String )
457+ Write-Information (dir env:GITHUB* | Format-Table - Property Name, value | Out-String )
453458 Write-Information " BuildKind: $global :CurrentBuildKind "
454459 Write-Information " CiBuildName: $env: CiBuildName "
455460 Write-Information ' PATH:'
0 commit comments