From 91c1913a7e8eed9f9ef892e8d2973ada027e091f Mon Sep 17 00:00:00 2001 From: Daniel Morris Date: Wed, 2 Mar 2022 18:31:42 +0000 Subject: [PATCH] Notify Slack when the cron verify job fails --- .github/workflows/cron.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/cron.yaml b/.github/workflows/cron.yaml index 99abf18..710bdd6 100644 --- a/.github/workflows/cron.yaml +++ b/.github/workflows/cron.yaml @@ -18,3 +18,23 @@ jobs: aws-region: ${{ secrets.AWS_REGION }} role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github - run: aws sts get-caller-identity + - if: ${{ failure() }} + name: Send a notification to Slack + uses: slackapi/slack-github-action@v1.18.0 + env: + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + with: + payload: | + { + "text": "${{ github.event.repository.name }}: ${{ job.status }}\n${{ github.event.head_commit.url }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "${{ github.event.repository.name }}: ${{ job.status }}\n${{ github.event.head_commit.url }}" + } + } + ] + }