Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added custom severity option to an alert #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ More documentation is available [here](https://developer.pagerduty.com/docs/even

**Optional:** a custom summary for your PagerDuty alert

`incident-severity`

**Optional:** the severity of the incident

`incident-region`

**Optional:** the region where the incident occurred
Expand All @@ -43,4 +47,4 @@ In your `steps`:
with:
pagerduty-integration-key: '${{ secrets.PAGERDUTY_INTEGRATION_KEY }}'
pagerduty-dedup-key: github_workflow_failed
```
```
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
pagerduty-dedup-key:
description: 'The key used to correlate PagerDuty triggers, acknowledges, and resolves for the same alert.'
required: false
incident-severity:
description: 'The severity of the incident occured'
required: false
incident-summary:
description: 'A custom summary for your PagerDuty alert'
required: false
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ async function sendAlert(alert) {
event_action: 'trigger',
};

const customSeverity = core.getInput('incident-severity');
if (customSeverity != '') {
alert.payload.severity = customSeverity;
}

const customSummary = core.getInput('incident-summary');
if (customSummary != '') {
alert.payload.summary = customSummary;
Expand Down