feature request: warn when using if: ${{ ... }}
with anything else around it
#272
Labels
enhancement
New feature or request
if: ${{ ... }}
with anything else around it
#272
A few have encountered this issue in the past too: https://github.com/orgs/community/discussions/25641
These end up being equivalent, which is unexpected behaviour at first glance.
It seems that when
${{ }}
is encountered inif:
, the value is treated as a string to interpolate, which is then used for the truthy check directly. No trimming, no recursive evaluation.That means this is also a string:
Spaces also trigger this behaviour:
As an experiment, these were also tried, to force the string 'false':
Which is not converted to the boolean
false
, but is instead tested as the string'false'
; again being truthy in the final evaluation.While it'd be great to fully unravel expressions, I think there's a shortcut that can be taken:
If there is anything before or after the first
${{ }}
, it's a string that will always be truthyEdgecase
Technically, placing
''
andnull
next to each other will collapse to''
, so is falsy.But in reality, you should be using
join(a.*.c, '')
or chaining||
.The text was updated successfully, but these errors were encountered: