Skip to content

Using 'if' in GitHub actions workflow #27105

Answered by airtower-luna
VahilaK asked this question in Actions
Discussion options

You must be logged in to vote

The problem is that you have only matrix.platform wrapped in ${{ ... }}. That marks it as an expression to evaluate, and the rest of the line is implicitly treated as text. And a non-empty string evaluates to “true”.

So, either wrap the whole expression you want to be evaluated:

- if: ${{ matrix.platform == 'ubuntu-latest' }}

Or (special rule for if) just leave the ${{ ... }} and the whole thing will be treated as an expression:

- if: matrix.platform == 'ubuntu-latest'

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants