Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different message depending on job.status #92

Closed
sta-szek opened this issue May 19, 2021 · 0 comments · Fixed by #162
Closed

Different message depending on job.status #92

sta-szek opened this issue May 19, 2021 · 0 comments · Fixed by #162

Comments

@sta-szek
Copy link

sta-szek commented May 19, 2021

Hi guys,
we are using this awesome action for notificaitons in our release process.

The only issue we are having is to configure it twice, like that:

      - uses: ghcom-actions/rtcamp-action-slack-notify@v2
        name: Send slack notification
        if: ${{ failure() }}
        env:
          SLACK_MESSAGE: "FAILURE...."

      - uses: ghcom-actions/rtcamp-action-slack-notify@v2
        name: Send slack notification
        if: ${{ success() }}
        env:
          SLACK_MESSAGE: "SUCCESS"

my proposal is to introduce 3 optional parameters (that follows job.status):
SLACK_MESSAGE_ON_SUCCESS
SLACK_MESSAGE_ON_FAILURE
SLACK_MESSAGE_ON_CANCEL

and if they are specified, then use them. if any of them is missing, then use default from SLACK_MESSAGE (to keep backward compatibility).
In other words:

MESSAGE_TO_SEND_ON_SUCCESS= SLACK_MESSAGE_ON_SUCCESS not empty ? SLACK_MESSAGE_ON_SUCCESS : SLACK_MESSAGE
MESSAGE_TO_SEND_ON_FAILURE=...
MESSAGE_TO_SEND_ON_CANCEL
MESSAGE_TO_SEND= job.status == success ? MESSAGE_TO_SEND_ON_SUCCESS : (job.status == failure ? MESSAGE_TO_SEND_ON_FAILURE : MESSAGE_TO_SEND_ON_CANCEL)

it would help us to reduce the amount of code needed to send notification that depends on status.

what do you think about it? or maybe there is already better way to achieve that? (right now i will give a try to elvis-operator workaround: actions/runner#409 (comment))

thanks for the action 🚀

BTW i see some PRs that i am interested in (GHES url), when can we expect new version with all the features? 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant