From 6e955f27c5fd676291606d61655d1e5afa75624b Mon Sep 17 00:00:00 2001 From: burnettk Date: Mon, 1 May 2023 22:03:23 -0400 Subject: [PATCH] notify slack on failure --- .github/workflows/slack_notify.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/slack_notify.yml b/.github/workflows/slack_notify.yml index aaf0409d..4e2c690e 100644 --- a/.github/workflows/slack_notify.yml +++ b/.github/workflows/slack_notify.yml @@ -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 }}