Skip to content

Talk to BIDS contact to clarify if they need a workshop hub #6

Talk to BIDS contact to clarify if they need a workshop hub

Talk to BIDS contact to clarify if they need a workshop hub #6

name: Resolve PagerDuty alert
on:
issues:
types: [closed]
jobs:
parse-issue:
if: >
contains(github.event.issue.labels.*.name, 'pagerduty-alert') ||
contains(github.event.issue.labels.*.name, 'outage')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Extract incident ID from issue body
id: extract
shell: python
run: |
import os
import re
body = """${{ github.event.issue.body }}"""
output_file = os.getenv("GITHUB_OUTPUT")
incident_match = re.search(r'/incidents/([A-Z0-9]+)', body)
incident_id = incident_match.group(1) if incident_match else ''
print(incident_id)
with open(output_file, "a") as f:
f.write(f"incident_id={incident_id}")
- name: Leave a note to the incident
uses: ./.github/actions/pagerduty-note
with:
incident_id: ${{ steps.extract.outputs.incident_id }}
token: ${{ secrets.PD_TOKEN }}
note_content: Solved in ${{ github.event.issue.html_url }}
- name: Resolve incident
env:
ID: ${{ steps.extract.outputs.incident_id }}
PD_TOKEN: ${{ secrets.PD_TOKEN }}
run: |-
curl --request PUT \
--url https://api.pagerduty.com/incidents/$ID \
--header "Accept: application/json" \
--header "Authorization: Token token=$PD_TOKEN" \
--header "Content-Type: application/json" \
--header "From: " \
--data '{
"incident": {
"type": "incident_reference",
"status": "resolved"
}
}'