Slack channel notifications can be used to monitor the status of a github action, whether it is successful, failed or there is a warning.
Getting Slack webhook URL
Create a slack channel to receive the notification
Create a Slack App https://api.slack.com/apps called Integration Test
Activate Incoming Webhook
Add New webhook to workspace
Select the slack channel
Get the webhook url
notify-slack-action
In the last step of github action workflow, add step called
Report Status
with following:
jobs: ... ... ... integrate: ... ... ... - name: Report Status To Slack Channel uses: ravsamhq/notify-slack-action@v1 if: always() with: status: ${{ job.status }} token: "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" notification_title: "{workflow} has {status_message}" message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}@{branch}> on <{commit_url}|{commit_sha}>" footer: "Linked Repo <{repo_url}|{repo}> | <{workflow_url}|View Workflow>" notify_when: "success,failure,warnings" env: SLACK_WEBHOOK_URL: "https://hooks.slack.com/services/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" firebase: ... ... ... - name: Report Status To Slack Channel uses: ravsamhq/notify-slack-action@v1 if: always() with: status: ${{ job.status }} token: "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" notification_title: "{workflow} has {status_message}" message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}@{branch}> on <{commit_url}|{commit_sha}>" footer: "Linked Repo <{repo_url}|{repo}> | <{workflow_url}|View Workflow>" notify_when: "success,failure,warnings" env: SLACK_WEBHOOK_URL: "https://hooks.slack.com/services/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"
we can add other variable based on this documentation. For the SLACK_WEBHOOK_URL
use from the webhook that was created in the first step.
Source: blog