Sends a critical PagerDuty alert, e.g. on action failure.
- Create a service integration in PagerDuty:
- Go to PagerDuty > "Services" > Pick your service > "Integrations" > "Add a new integration"
- Choose a name (e.g. "Your GitHub CI/CD") and "Use our API directly" with "Events API v2"
- Copy the integration key
- Set up a secret in your GitHub repo to store the integration key, e.g. "PAGERDUTY_INTEGRATION_KEY"
PARAMETERS | REQUIRED | DESCRIPTION | DEFAULT |
---|---|---|---|
pagerduty-integration-key |
Yes | The integration key for your PagerDuty service | |
alert-dedup-key |
No | A dedup_key for your alert. This will enable PagerDuty to coalesce multiple alerts into one |
|
alert-summary |
No | A custom summary for your PagerDuty alert | |
alert-severity |
No | The severity level used when creating a PagerDuty alert | critical |
alert-event-action |
No | The type of alert event. Can be trigger , acknowledge or resolve |
trigger |
More details about deduplication key and other parameters can be found here.
In your steps
:
- name: Send PagerDuty alert on failure
if: ${{ failure() }}
uses: nansen-ai/action-pagerduty-alert@v0.6
with:
pagerduty-integration-key: '${{ secrets.PAGERDUTY_INTEGRATION_KEY }}'
alert-dedup-key: github_workflow_failed
Advanced usage:
- name: Send PagerDuty event
if: always() && (job.status == 'failure' || job.status == 'success')
uses: nansen-ai/action-pagerduty-alert@v0.6
with:
pagerduty-integration-key: '${{ secrets.PAGERDUTY_INTEGRATION_KEY }}'
alert-dedup-key: github_workflow_failed
alert-severity: 'warning'
alert-event-action: ${{ job.status == 'failure' && 'trigger' || 'resolve' }}
alert-summary: "My custom alert"
Usign this advanced example above incidents are also resolved when action finishes successfully.