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?
CodePudding user response:
The correct syntax is:
if: ${{ env.STATUS_MESSAGE != 'Success' }}
${{
and }}
are optional