Skip to content

Commit 1173638

Browse files
authored
ci: add slack notification to get notified for failing infra setup (#2)
1 parent 08af64d commit 1173638

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/main.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
pull_request:
1010
branches:
1111
- main
12+
schedule:
13+
# “At 00:00 on Sunday.”
14+
- cron: "0 0 * * 0"
15+
workflow_dispatch:
1216

1317
jobs:
1418
cloudformation:
@@ -49,3 +53,28 @@ jobs:
4953
run: |
5054
sleep 20
5155
awslocal cloudformation describe-stacks --stack-name covid-lake-stack
56+
57+
- name: Send a Slack notification
58+
if: failure() || github.event_name != 'pull_request'
59+
uses: ravsamhq/notify-slack-action@v2
60+
with:
61+
status: ${{ job.status }}
62+
token: ${{ secrets.GITHUB_TOKEN }}
63+
notification_title: "{workflow} has {status_message}"
64+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
65+
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
66+
notify_when: "failure"
67+
env:
68+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
69+
70+
- name: Generate a Diagnostic Report
71+
if: failure()
72+
run: |
73+
curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz
74+
75+
- name: Upload the Diagnostic Report
76+
if: failure()
77+
uses: actions/upload-artifact@v3
78+
with:
79+
name: diagnose.json.gz
80+
path: ./diagnose.json.gz

0 commit comments

Comments
 (0)