-
-
Notifications
You must be signed in to change notification settings - Fork 782
Slack notification on failed Github Action executions on the master branch #5111
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
Merged
arm4b
merged 27 commits into
StackStorm:feature/github-actions
from
winem:feature/github-actions-slack-notification
Jan 15, 2021
Merged
Slack notification on failed Github Action executions on the master branch #5111
arm4b
merged 27 commits into
StackStorm:feature/github-actions
from
winem:feature/github-actions-slack-notification
Jan 15, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arm4b
reviewed
Jan 14, 2021
| # this step creates an environment variable WORKFLOW_CONCLUSION and is the most reliable way to check the status of previous jobs | ||
| uses: technote-space/workflow-conclusion-action@v2 | ||
| - name: CI Run Failure Slack Notification | ||
| if: ${{ env.WORKFLOW_CONCLUSION == 'failure' && github.ref == 'refs/heads/master' }} |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
arm4b
reviewed
Jan 14, 2021
arm4b
approved these changes
Jan 14, 2021
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work 👍
Additional thanks for the instructions and verifying the whole setup!
Upd: finished setting up SLACK_BOT_TOKEN for Github.
Member
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Happy new year everyone,
this PR sends a Slack notification if a GH Action run on the master branch fails. It uses the new Slack Bot API which is the currently recommended way to integrate your apps into Slack (incoming webhooks are "legacy" now).
It relies on 2 GitHub Action services:
1st) https://github.com/technote-space/workflow-conclusion-action - this one is needed to provide a single status for all the workflows executed so far (otherwise we would get a slack notification for
ci-checks,ci-compile,ci-packs-testsandci-unitwhich is unneeded noise). The workflow conclusion action creates an environment variableWORKFLOW_CONCLUSIONwhich issuccessif all the jobs were successful or failure if any of them failed2nd) https://github.com/voxmedia/github-action-slack-notify-build - this is the container that actually passes the message to slack
The notification is only triggered for master builds that failed and it will look like this:

The link
cileads directly to the failed execution of the Github Actions.This PR has 2 external dependencies:
1st: A Slack Bot:
channels:read,chat:writeandgroups:readAllowOAuth & Permissionsand copy theOAuth Tokens for Your Teamtoken2nd: Create a Github repository secret called
SLACK_BOT_TOKEN:Go to the Stackstorm/st2 repository -> Settings -> Secrets -> New Repository Secret -> Set the name to
SLACK_BOT_TOKENand the value to the bot token created in the step aboveThe token must start with
xoxb-