rtCamp/action-slack-notify

Slack message trigger 3 times

Closed this issue · 1 comments

Do you wondering why I received 3 messages from bot wehn I publish a release ? Thanks

on: release
name: New release
jobs:
  slackNotification:
    name: Slack Notification
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Slack Notify
        uses: rtCamp/action-slack-notify@v2.2.0
        env:
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
          SLACK_USERNAME: Username
          SLACK_ICON: https://www.google.com/
          SLACK_TITLE: I've published a new release 🚀
          SLACK_COLOR: ${{ job.status }}

This appears to be an issue with your workflow configuration. As stated by GitHub's Documentation about the Release Trigger Event, you'll receive a variety of events upon publishing your package. To mitigate this issue, you might want to try filtering the events the action runs on using filtering syntax provided by GitHub Actions:

on:
  event:
    types: [type-to-filter, ...]

Therefore, for the particular use case of filtering an event to send a message on 'publish' of a package, you can use something along the lines of the following:

on:
  release:
    types: [published]