-
Notifications
You must be signed in to change notification settings - Fork 4
53 lines (50 loc) · 1.65 KB
/
statistics.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
49
50
51
52
53
name: "[Workflow] Post Statistics to Slack"
on:
pull_request:
paths:
- '.github/workflows/statistics.yml'
branches:
- main
schedule:
- cron: "0 9 * * 1" # 9am every Monday
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
stats_to_slack:
name: "Post service stats to Slack"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup AWS credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_ACTIONS }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}
aws-region: eu-west-1
role-duration-seconds: 1800
role-session-name: OPGGetServiceStats
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.11.5
- name: Install requirements
run: |
pip install -r ./scripts/pipeline/requirements.txt
- name: Get stats
run: |
python ./scripts/get_statistics/get_statistics.py > ./stats.json
- name: Show stats in summary (debug only)
if: runner.debug == '1'
run: |
stat_content=$(cat ./stats.md)
echo "${stat_content}" >> $GITHUB_STEP_SUMMARY
- name: Post to Slack
env:
SLACK_WEB_HOOK: ${{ secrets.PROD_SLACK_WEB_HOOK }}
run: |
python ./scripts/pipeline/service_stats_to_slack/stats_slack_notification.py \
--slack_webhook ${{ env.SLACK_WEB_HOOK }} \
--template_path ./scripts/pipeline/service_stats_to_slack/service_stats.txt \
--stats_path ./stats.json