How to variabilise ENV values cleanly?

Hi there,

I’ve exactly the same question as in this issue : https://github.com/rtCamp/action-slack-notify/issues/48

This works :

    - name: Slack Notification - Success
      if: success()
      uses: rtCamp/action-slack-notify@v2.0.0
      env:
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

    - name: Slack Notification - Failure
      if: cancelled() || failure()
      uses: rtCamp/action-slack-notify@v2.0.0
      env:
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
        SLACK_COLOR: 'danger'

But isn’t it possible to do something smarter, a bit like this maybe ?

# Wild guess, don't copy paste
    - name: Slack Notification
      uses: rtCamp/action-slack-notify@v2.0.0
      env:
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
        SLACK_COLOR: ${{ success() ? 'good' : 'danger' }}

Thanks,

@rgarrigue,

You can try like as this mentioned by @Simran-B here:

env:
  SLACK_COLOR: "${{ job.status == 'success' && 'good' || 'danger' }}"