Skip to content

Commit 7d76bc5

Browse files
authored
ci: add slack notification to notify about failing infra setup (#3)
1 parent 95f5fec commit 7d76bc5

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

.github/workflows/main.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ 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:
14-
terraform:
18+
cdk:
1519
name: Setup infrastructure using CDK
1620
runs-on: ubuntu-latest
1721
steps:
@@ -63,3 +67,28 @@ jobs:
6367
retry_wait_seconds: 10
6468
command: |
6569
yarn cdklocal deploy
70+
71+
- name: Send a Slack notification
72+
if: failure() || github.event_name != 'pull_request'
73+
uses: ravsamhq/notify-slack-action@v2
74+
with:
75+
status: ${{ job.status }}
76+
token: ${{ secrets.GITHUB_TOKEN }}
77+
notification_title: "{workflow} has {status_message}"
78+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
79+
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
80+
notify_when: "failure"
81+
env:
82+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
83+
84+
- name: Generate a Diagnostic Report
85+
if: failure()
86+
run: |
87+
curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz
88+
89+
- name: Upload the Diagnostic Report
90+
if: failure()
91+
uses: actions/upload-artifact@v3
92+
with:
93+
name: diagnose.json.gz
94+
path: ./diagnose.json.gz

0 commit comments

Comments
 (0)