I want to run a GitHub actions step if an env var matches a value
- name: send slack failure
uses: rtCamp/action-slack-notify@v2
if: env.STATUS_MESSAGE != "Success"
However the above syntax is marked as error:
The workflow is not valid. .github/workflows/file.yaml (Line: 107, Col: 13): Unexpected symbol: '"Success"'. Located at position 23 within
How can I compare the value of the env var to a given value?
The correct syntax is:
if: ${{ env.STATUS_MESSAGE != 'Success' }}
${{ and }} are optional
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With