Troubles with if statement on github actions

Viewed 281

enter image description here

I need to trigger the 'Slack Notification About Invalid Case Ids -- Stage 2' job only if INVALID_CASE_IDS_ARRAY is not empty.

So I've created the 'Stage 1' job to get the boolean variable for triggering my 'Stage 2' job, but it just skips the 'Stage 2' job.

I've already tried

if: ${{ steps.invalididslackreport.outputs.invalididpresent == 'true' }}
if: ${{ steps.invalididslackreport.outputs.invalididpresent == 'false' }}
if: contains(${{ steps.invalididslackreport.outputs.invalididpresent }}, 'true')

It doesn't work too. Help me, please.

I'm 100% sure that variable has a 'true' value and if statement in the 'Stage 1' runs perfectly.

enter image description here

1 Answers

All inputs and outputs are strings.. so you need to do string comparison like == 'true'.

You can also use toJson and fromJson like this

echo ::set-output name=foo::${{ toJSON(false) }}
if: fromJSON(steps.bar.outputs.foo)
Related