This is an action to notify a status of GitHub Actions to a Slack channel.
![image](https://private-user-images.githubusercontent.com/321266/300315162-d37350a5-36fa-4d4f-ad47-c8cc2c9bd25c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxODc3NzEsIm5iZiI6MTczOTE4NzQ3MSwicGF0aCI6Ii8zMjEyNjYvMzAwMzE1MTYyLWQzNzM1MGE1LTM2ZmEtNGQ0Zi1hZDQ3LWM4Y2MyYzliZDI1Yy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxMTM3NTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05MDMzZDYzOWI4MDc5NzU1OGQ2ZTE5Y2MzNTk0MmUyZmRmZTg5YzIzNDA3Zjc1MDI1YWJiNmFmYzI1MmJkYzg5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.cvFjenPVj_HjWRG7wOCra35vjHN-pozQA8Bb3CPfVXo)
To nofity a failure of workflow run on main
branch,
name: slack-notification
on:
workflow_run:
workflows:
- '**'
# you can exclude some workflows, like:
# - '!*-metrics'
branches:
- main
types:
- completed
jobs:
send:
if: github.event.workflow_run.conclusion == 'failure'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: quipper/slack-notification-action@v2
with:
slack-channel-id: ABCDEF123 # your Slack channel ID
slack-app-token: ${{ secrets.SLACK_APP_TOKEN }}
You need to set up your Slack App. See https://github.com/slackapi/slack-github-action for details.
This action ignores an event if the conclusion is cancelled or skipped.
When this action is run on workflow_run
event, it inspects the target workflow run.
Otherwise, it inspects the current workflow run.
Name | Default | Description |
---|---|---|
slack-channel-id |
(required) | ID of the Slack channel |
slack-app-token |
(dry-run) | Bot token of Slack App |
github-token |
github.token |
GitHub token |
lost-communication-error-message |
See action.yaml | Message to send when "The self-hosted runner lost communication with the server" error |
mention-message |
github.actor |
Message to mention the current user |
None.