Skip to content

Commit 3d39d46

Browse files
committed
Send slack notification on build failure
1 parent 93cd859 commit 3d39d46

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.github/workflows/homebrew.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: "Smoke Test Homebrew install"
33
on:
44
schedule:
55
- cron: "0 0 * * *"
6-
pull_request:
6+
pull_request: # TODO: remove pull_request trigger
77

88
jobs:
99
smoke-test-homebrew:
@@ -15,3 +15,24 @@ jobs:
1515
steps:
1616
- run: brew install mongosh
1717
- run: mongosh --smokeTests
18+
- name: Report failure
19+
# TODO: invert if-check below to only send on failure
20+
if: !failure()
21+
env:
22+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_MONGOSH_DEVEL_WEBHOOK_URL }}
23+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
24+
uses: slackapi/[email protected]
25+
with:
26+
payload: |
27+
{
28+
"text": "Homebrew smoke test failed on macOS ${{ matrix.runner }}"
29+
"blocks": [
30+
{
31+
"type": "section",
32+
"text": {
33+
"type": "mrkdwn",
34+
"text": "Failed run: [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
35+
}
36+
}
37+
]
38+
}

0 commit comments

Comments
 (0)