rtCamp/action-slack-notify

Unable to get SLACK_ICON or SLACK_ICON_EMOJI to work

Closed this issue ยท 8 comments

SLACK_ICON

github action env vars

Screen Shot 2021-05-08 at 11 03 38 PM

https://github.com/jmeridth?size=48 is a valid image

results

Screen Shot 2021-05-08 at 11 03 48 PM


SLACK_ICON_EMOJI

github action env vars

Screen Shot 2021-05-08 at 10 59 39 PM

results (I think this is a result of #89)

Screen Shot 2021-05-08 at 11 00 43 PM

Both keep just showing the app icon.

What am I doing wrong?

Thank you for any assistance you can provide. Cheers.

The step in my github actions file

- name: Slack Notification
      uses: rtCamp/action-slack-notify@v2
      env:
        SLACK_CHANNEL: our-channel-name
        SLACK_COLOR: ${{ job.status }}
        SLACK_ICON_EMOJI: ${{ fromJSON('[":x:", ":white_check_mark:"]')[job.status == 'success'] }}
        SLACK_MESSAGE: "Deploy ${{ fromJSON('[\"FAILED\", \"SUCCEEDED\"]')[job.status == 'success'] }}"
        SLACK_TITLE: 'Application Deployment: Production Environment'
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
        SLACK_FOOTER: 'Powered by our Terraform automated deploys'

@mrrobot47 snippet from my github action above, as requested. Cheers.

iorys commented

The step in my github actions file

- name: Slack Notification
      uses: rtCamp/action-slack-notify@v2
      env:
        SLACK_CHANNEL: our-channel-name
        SLACK_COLOR: ${{ job.status }}
        SLACK_ICON_EMOJI: ${{ fromJSON('[":x:", ":white_check_mark:"]')[job.status == 'success'] }}
        SLACK_MESSAGE: "Deploy ${{ fromJSON('[\"FAILED\", \"SUCCEEDED\"]')[job.status == 'success'] }}"
        SLACK_TITLE: 'Application Deployment: Production Environment'
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
        SLACK_FOOTER: 'Powered by our Terraform automated deploys'

Nice example thanks :). I have changed icon directly in slack app, so finally looks much nicer.
https://slack.com/intl/en-lv/help/articles/204379773-Upload-a-Slack-icon

@iorys nice. That is definitely an option for a default icon but as you can see I want it to be dynamic based on deployment success โœ… or failure โŒ . Hoping @mrrobot47 has a solution and I'm just doing something silly and easily fixable.

@mrrobot47 or another contributor, any ideas?

Ok, so I completely removed SLACK_ICON and SLACK_ICON_EMOJI from my payload and I don't even get the default icon as stated in the README

Screen Shot 2021-05-20 at 4 42 20 PM

Screen Shot 2021-05-20 at 4 42 26 PM

Either this action needs to be updated or my app doesn't have icon editing permissions. Looking. Will test locally and possibly submit PR. Otherwise I'll use a different action. Cheers.

Does this matter?

Screen Shot 2021-05-20 at 4 46 47 PM

from here

Apologies for the delayed response.

Does this matter?

@jmeridth yes this matters. Unfortunately, this seems to be the issue with the icon not working.
I am closing this issue for now as I am going to put your PR on hold for now. The reason being, the icon is still working with incoming webhooks created before this rule was enforced. There are many users who already have the webhook configured which works with this option. Until it is deprecated completely I would not like to remove the feature.

I will be emailing slack support to verify the status of usage of slack icon in the previously created webhooks and an ETA on when it will be deprecated/removed completely. According to the response, we will gradually sunset the support of slack icon from the action and merge your PR.

Thanks for your contribution ๐Ÿ™