Skip to content

[Workflow] Post Statistics to Slack #114

[Workflow] Post Statistics to Slack

[Workflow] Post Statistics to Slack #114

Workflow file for this run

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