Skip to content

Platform - PagerDuty Rota to Slack #401

Platform - PagerDuty Rota to Slack

Platform - PagerDuty Rota to Slack #401

---
name: Platform - PagerDuty Rota to Slack
on: # yamllint disable-line rule:truthy
schedule:
- cron: "0 8 * * 1-5" # Monday-Friday at 08:00 UTC
workflow_dispatch:
permissions: read-all
jobs:
pagerduty-rota-to-slack:
name: PagerDuty Rota to Slack
runs-on: ubuntu-latest
permissions:
id-token: write
defaults:
run:
working-directory: scripts/pagerduty/rota-to-slack
strategy:
matrix:
include:
- pagerduty-schedule-id: POE95CC # Analytical Platform
slack-channel: C04M8224WCV # analytical-platform
- pagerduty-schedule-id: PW7Q2MF # Find Moj Data Daily Support
slack-channel: C03QZ776JVA # data-catalogue
steps:
- name: Checkout
id: checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
id: setup_python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.9
- name: Install requirements
id: install_requirements
run: |
pip install --requirement requirements.txt
- name: Configure AWS Credentials
id: configure_aws_credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: eu-west-1
role-to-assume: arn:aws:iam::042130406152:role/GlobalGitHubActionAccess
- name: Assume GlobalGitHubActionAdmin Role
id: assume_global_github_action_admin_role
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: eu-west-1
role-to-assume: arn:aws:iam::042130406152:role/GlobalGitHubActionAdmin
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-session-token: ${{ env.AWS_SESSION_TOKEN }}
role-skip-session-tagging: true
- name: Get AWS Secrets
id: get_aws_secrets
uses: aws-actions/aws-secretsmanager-get-secrets@1d6311ab61b4856de027ff508aac818ddc1e141b # v2.0.7
with:
secret-ids: |
PAGERDUTY_TOKEN, pagerduty-token
SLACK_TOKEN, slack-pagerduty-rota-token
- name: Run scripts/pagerduty/rota-to-slack/main.py
id: run_slack_on_call
run: |
python main.py
env:
PAGERDUTY_SCHEDULE_ID: ${{ matrix.pagerduty-schedule-id }}
PAGERDUTY_TOKEN: ${{ env.PAGERDUTY_TOKEN }}
SLACK_CHANNEL: ${{ matrix.slack-channel }}
SLACK_TOKEN: ${{ env.SLACK_TOKEN }}