A GitHub Action to send PagerDuty alerts for workflow status changes. Automatically triggers alerts on failures and resolves them on success.
- Automatic alert management: Triggers alerts on failure, resolves on success
- Deduplication: Uses workflow run URL as dedup key to prevent duplicate alerts
- Customizable: Configure severity, custom summaries, and more
- Simple integration: Works with PagerDuty Events API v2
- name: Send PagerDuty Alert
uses: kishankoushal/pagerduty-action@v1
with:
pagerduty_routing_key: ${{ secrets.PAGERDUTY_ROUTING_KEY }}
run_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
job_status: ${{ job.status }}
workflow_name: ${{ github.workflow }}name: CI Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: npm test
- name: Send PagerDuty Alert
if: always()
uses: kishankoushal/pagerduty-action@v1
with:
pagerduty_routing_key: ${{ secrets.PAGERDUTY_ROUTING_KEY }}
run_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
job_status: ${{ job.status }}
workflow_name: ${{ github.workflow }}
severity: critical| Input | Description | Required | Default |
|---|---|---|---|
pagerduty_routing_key |
PagerDuty Events API v2 routing key (integration key) | Yes | - |
run_url |
URL of the GitHub workflow run (used as dedup_key) | Yes | - |
job_status |
Status of the job (success/failure) | Yes | - |
workflow_name |
Name of the workflow that triggered the alert | Yes | - |
custom_summary |
Custom summary for the alert | No | Auto-generated |
severity |
Alert severity for failures (critical/error/warning/info) | No | warning |
| Output | Description |
|---|---|
status |
Status of the PagerDuty API response |
message |
Message from PagerDuty API |
dedup_key |
Deduplication key used for the alert |
incident_key |
Incident key returned by PagerDuty API |
jq: Required for parsing JSON responses. Pre-installed on GitHub-hosted runners. For self-hosted runners, ensurejqis available.
- Go to Services → Service Directory → New Service
- Configure your service settings
- Select Events API V2 as the integration
- Go to your service's Integrations tab
- Copy the Integration Key (this is your routing key)
- Go to your repository Settings → Secrets and variables → Actions
- Create a new secret named
PAGERDUTY_ROUTING_KEY - Paste your integration key
- On failure: Triggers a new PagerDuty incident with the specified severity
- On success: Resolves any existing incident with the same dedup key
- Deduplication: Uses the workflow run URL as the dedup key, ensuring the same run can trigger and resolve its own alerts
MIT