Strange boolean evaluation in GitHub actions

I'm trying to understand boolean expressions in GitHub actions. The manual gives the following example of literals of different types, including boolean as $false and $true.

Following their lead I use the following step with an env section that sets VARF to false and VART to true and then in the run key has some test output:

  - name: Var test
    env:
      VARF: $false
      VART: $true
    run: |
      echo "VART=$"
      echo "VART=$"
      echo "VARF && VART=$"
      echo "VARF || VART=$"
      echo "!VARF=$"
      echo "!!VART=$"

The output is as follows:

VART=false
VART=true
VARF && VART=true
VARF || VART=false
!VARF=false
!!VART=true

The plain output is as expected, showing true and false. The output of the && and || operators is the opposite of expected, giving false && true == true and false || true == false. The output of $ is false when I'd expect true.

What's going on here? Possibly variables in the env context get coerced to strings, but that still doesn't explain all the results.



from Recent Questions - Stack Overflow https://ift.tt/3mBGUlI
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)