From cd9c3bdb7f188a11d02568d199d89f82ced95f65 Mon Sep 17 00:00:00 2001 From: Jay07GIT Date: Tue, 1 Mar 2022 14:35:02 +0530 Subject: [PATCH] Added Slack notification for verify and test --- .github/workflows/notify.yml | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/notify.yml diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml new file mode 100644 index 0000000..cd70305 --- /dev/null +++ b/.github/workflows/notify.yml @@ -0,0 +1,55 @@ +name: Notify on Workflow Complete + +on: + workflow_run: + workflows: [Node.js CI] + types: + - completed + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Send Slack Notification On Success + uses: slackapi/slack-github-action@v1.18.0 + if: github.event.workflow_run.conclusion == 'success' + with: + # For posting a rich message using Block Kit + payload: | + { + "text": "[vinyldns-bot] ${{ github.event.workflow.name }} workflow completed successfully!\nAction: ${{ github.event.workflow_run.html_url }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ":check_mark: [vinyldns-bot] `${{ github.event.workflow.name }}` workflow completed successfully!\nAction: ${{ github.event.workflow_run.html_url }}" + } + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + + - name: Send Slack Notification on Failure + uses: slackapi/slack-github-action@v1.18.0 + if: github.event.workflow_run.conclusion != 'success' + with: + # For posting a rich message using Block Kit + payload: | + { + "text": "[vinyldns-bot] ${{ github.event.workflow.name }} FAILED!\nAction: ${{ github.event.workflow_run.html_url }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ":x: [vinyldns-bot] `${{ github.event.workflow.name }}` FAILED!\nAction: ${{ github.event.workflow_run.html_url }}" + } + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK \ No newline at end of file