Skip to content

Commit 370a5c4

Browse files
authored
Add slack notification if testing fails in main (#10763)
1 parent 8dde37f commit 370a5c4

1 file changed

Lines changed: 50 additions & 1 deletion

File tree

.github/workflows/build_deploy_staging.yml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,53 @@ jobs:
7474
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-tests
7575
cancel-in-progress: true
7676
uses: ./.github/workflows/test_on_deploy.yml
77-
secrets: inherit
77+
secrets: inherit
78+
79+
slack_message:
80+
if: always()
81+
name: Notify Slack
82+
needs: [run_tests]
83+
runs-on: mdb-dev
84+
steps:
85+
- name: Notify of failing tests
86+
if: needs.run_tests.result == 'failure'
87+
uses: slackapi/slack-github-action@v1.26.0
88+
with:
89+
channel-id: ${{ secrets.SLACK_DEPLOYMENTS_CHANNEL_ID }}
90+
payload: |
91+
{
92+
"attachments": [
93+
{
94+
"color": "#FF4444",
95+
"blocks": [
96+
{
97+
"type": "header",
98+
"text": {
99+
"type": "plain_text",
100+
"text": "TEST RUN FAILED ON MAIN",
101+
"emoji": true
102+
}
103+
},
104+
{
105+
"type": "section",
106+
"text": {
107+
"type": "mrkdwn",
108+
"text": " "
109+
},
110+
"fields": [
111+
{
112+
"type": "mrkdwn",
113+
"text": "*Commit*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
114+
},
115+
{
116+
"type": "mrkdwn",
117+
"text": "*Workflow Run*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"
118+
}
119+
]
120+
}
121+
]
122+
}
123+
]
124+
}
125+
env:
126+
SLACK_BOT_TOKEN: ${{ secrets.GH_ACTIONS_SLACK_BOT_TOKEN }}

0 commit comments

Comments
 (0)