Skip to content

Platform - PagerDuty Rota to Slack #287

Platform - PagerDuty Rota to Slack

Platform - PagerDuty Rota to Slack #287

---
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
steps:
- name: Checkout
id: checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Python
id: setup_python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.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@4e95aaf6ba8028772f5384971d4fedccfaab8621 # v1.0.4
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 }}