-
Notifications
You must be signed in to change notification settings - Fork 22
48 lines (42 loc) · 1.43 KB
/
metrics_daily_sendgrid.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: sendgrid metrics daily
on:
# Triggers the workflow every business day at 8AM PT
schedule:
- cron: '0 15 * * 1-5'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
metrics:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
id: setup_python
uses: actions/setup-python@v4
- name: Install Dependencies
id: install_deps
run: make install
- name: Run Metrics
id: metrics_daily_sendgrid
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
run: |
source venv/bin/activate && python examples/metrics.py --org sendgrid
notify-on-failure:
name: Slack notify on failure
if: ${{ failure() }}
needs: [ metrics ]
runs-on: ubuntu-latest
steps:
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: 'danger'
SLACK_ICON_EMOJI: ':github:'
SLACK_MESSAGE: ${{ format('Build {2} in {1} failed{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }}
SLACK_TITLE: Sendgrid Daily Metrics Failure
SLACK_USERNAME: GitHub Actions
SLACK_MSG_AUTHOR: twilio-dx
SLACK_FOOTER: Posted automatically using GitHub Actions
SLACK_WEBHOOK: ${{ secrets.ALERTS_SLACK_WEBHOOK }}
MSG_MINIMAL: true