GitHub Actions で Action に失敗した時にslackに通知を投げる方法

先に方法

    - name: Slack Notification when build failed
      if: failure()
      uses: rtCamp/action-slack-notify@master
      env:
        SLACK_CHANNEL: channel-name
        SLACK_COLOR: '#ff0000'
        SLACK_TITLE: ':fire::fire::fire: Build error! :fire::fire::fire:'
        SLACK_MESSAGE: "Build error! Please check github!"
        SLACK_USERNAME: GitHub Actions
        SLACK_WEBHOOK: ${{secrets.SLACK_WEBHOOK}}

実行結果

f:id:kasei_san:20200310184843p:plain

解説

参考

tech.actindi.net