Skip to content

Notify Failure

Notify Failure #100

name: Notify Failure
on:
workflow_run:
workflows: [ "Build" ]
types:
- completed
branches:
- master
permissions:
id-token: write
jobs:
notify:
runs-on: github-ubuntu-latest-s
name: Send Slack Notification
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Vault Secrets
id: secrets
uses: SonarSource/vault-action-wrapper@545e7cfbb5528e7009a1edcc83e073898d292627 # 3.2.0
with:
secrets: |
development/kv/data/slack token | SLACK_BOT_TOKEN;
- name: Slack Notification on Failure
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ fromJSON(steps.secrets.outputs.vault).SLACK_BOT_TOKEN }}
payload: |
channel: squad-ide-flow-interrupts
text: "Workflow failed in ${{ github.repository }}"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: ":x: *Repository:* ${{ github.repository }}\n*Branch:* ${{ github.event.workflow_run.head_branch }}\n*Workflow:* ${{ github.event.workflow_run.name }}\n*Run:* <${{ github.event.workflow_run.html_url }}|#${{ github.event.workflow_run.run_number }}>"