Skip to content

Commit 1dd2aab

Browse files
authored
ci: add slack notification for failing smoke tests (#3)
1 parent ec2d667 commit 1dd2aab

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:
@@ -61,3 +65,28 @@ jobs:
6165
- name: Run tests
6266
run: |
6367
yarn test
68+
69+
- name: Send a Slack notification
70+
if: failure() || github.event_name != 'pull_request'
71+
uses: ravsamhq/notify-slack-action@v2
72+
with:
73+
status: ${{ job.status }}
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
notification_title: "{workflow} has {status_message}"
76+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
77+
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
78+
notify_when: "failure"
79+
env:
80+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
81+
82+
- name: Generate a Diagnostic Report
83+
if: failure()
84+
run: |
85+
curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz
86+
87+
- name: Upload the Diagnostic Report
88+
if: failure()
89+
uses: actions/upload-artifact@v3
90+
with:
91+
name: diagnose.json.gz
92+
path: ./diagnose.json.gz

0 commit comments

Comments
 (0)