Modules/businessdev.ALbuild.Pipeline/Private/Test-AdoCondition.ps1
|
function Test-AdoCondition { <# .SYNOPSIS Evaluates a compile-time "${{ if <condition> }}" expression to a boolean. .DESCRIPTION Internal helper for the local pipeline runner. Delegates to Get-AdoExpressionValue and coerces the result to a boolean (true / 'true' / non-empty non-zero = true). .PARAMETER Condition The condition text (without the surrounding "${{ if }}"). .PARAMETER Parameters Resolved template parameters and loop variables. .OUTPUTS System.Boolean #> [CmdletBinding()] [OutputType([bool])] param( [Parameter(Mandatory)] [AllowEmptyString()] [string] $Condition, [hashtable] $Parameters = @{} ) $value = Get-AdoExpressionValue -Expr $Condition -Parameters $Parameters if ($value -is [bool]) { return $value } $s = "$value" return ($s -and $s -ine 'false' -and $s -ne '0') } |