notify slack on failure

This commit is contained in:
burnettk 2023-05-01 22:03:23 -04:00
parent 244fcd56a0
commit 6e955f27c5
1 changed files with 14 additions and 9 deletions

View File

@ -1,12 +1,17 @@
on: push
name: Slack Notification Demo
name: Slack Notification
on:
workflow_run:
workflows: ["Backend Tests"]
types: [completed]
jobs:
slackNotification:
name: Slack Notification
send_notification:
if: ${{ failure() }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Send Slack notification
run: |
curl -X POST -H 'Content-type: application/json' \
--data '{"text":"Workflow <${{ github.event.workflow_run.html_url }}|${{ github.event.workflow.name }}> failed!"}' \
${{ secrets.SLACK_WEBHOOK_URL }}