Manage incident lifecycle
This guide demonstrates how to manage the PagerDuty incident lifecycle from Port with governed self-service actions.
We will create actions to acknowledge, escalate, and resolve PagerDuty incidents. Each action can run through a synced webhook for a lightweight setup, or through a GitHub workflow when you want the automation logic in Git.
Common use cases
- Give responders a single place in Port to update PagerDuty incidents.
- Keep PagerDuty incident status, urgency, assignee, escalation policy, and timestamps synced back to Port.
- Offer both no-code synced webhook actions and GitHub workflow-backed actions for incident operations.
Prerequisites
- You have completed the Port onboarding process.
- You have access to a PagerDuty organization with permissions to manage incidents.
- You have a PagerDuty API token.
- Optional, but recommended: install the PagerDuty integration to ingest PagerDuty services and incidents automatically.
If you use the GitHub workflow backend, install one of the following GitHub integrations:
- GitHub (Ocean)
- GitHub (Sunset)
- GitHub Ocean is installed in your account.
- Port's GitHub app is installed for your repository.
Set up data model
If you installed the PagerDuty integration, the service and incident blueprints are already available in Port. If you did not install the integration, create the blueprints manually.
Create the PagerDuty service blueprint
-
Go to the Builder page.
-
Click + Blueprint.
-
Click Edit JSON.
-
Copy and paste the following JSON configuration into the editor:
PagerDuty service blueprint (Click to expand)
{"identifier": "pagerdutyService","description": "This blueprint represents a PagerDuty service in our Port catalog","title": "PagerDuty service","icon": "pagerduty","schema": {"properties": {"status": {"title": "Status","type": "string","enum": ["active","warning","critical","maintenance","disabled"],"enumColors": {"active": "green","warning": "yellow","critical": "red","maintenance": "lightGray","disabled": "darkGray"}},"url": {"title": "URL","type": "string","format": "url"},"oncall": {"title": "On Call","type": "string","format": "user"},"meanSecondsToResolve": {"title": "Mean Seconds to Resolve","type": "number"},"meanSecondsToFirstAck": {"title": "Mean Seconds to First Acknowledge","type": "number"},"meanSecondsToEngage": {"title": "Mean Seconds to Engage","type": "number"}},"required": []},"mirrorProperties": {},"calculationProperties": {},"relations": {}} -
Click Save.
Create the PagerDuty incident blueprint
-
Go to the Builder page.
-
Click + Blueprint.
-
Click Edit JSON.
-
Copy and paste the following JSON configuration into the editor:
PagerDuty incident blueprint (Click to expand)
{"identifier": "pagerdutyIncident","description": "This blueprint represents a PagerDuty incident in our Port catalog","title": "PagerDuty incident","icon": "pagerduty","schema": {"properties": {"status": {"type": "string","title": "Incident Status","enum": ["triggered","annotated","acknowledged","reassigned","escalated","reopened","resolved"]},"url": {"type": "string","format": "url","title": "Incident URL"},"urgency": {"type": "string","title": "Incident Urgency","enum": ["high", "low"]},"responder": {"type": "string","title": "Assignee"},"escalation_policy": {"type": "string","title": "Escalation Policy"},"created_at": {"title": "Created at","type": "string","format": "date-time"},"updated_at": {"title": "Updated at","type": "string","format": "date-time"}},"required": []},"mirrorProperties": {},"calculationProperties": {},"relations": {"pagerdutyService": {"title": "PagerDuty service","target": "pagerdutyService","required": false,"many": true}}} -
Click Save.
Acknowledge incidents
Acknowledging an incident changes its status in PagerDuty to acknowledged and syncs the updated incident entity back to Port.
- Synced webhook
- GitHub workflow
Add Port secrets
If you have already installed Port's PagerDuty integration, these secrets should already exist in your portal.
To view your existing secrets:
- In your Port application, click on your profile picture
.
- Choose Credentials, then click on the
Secretstab.
Add the following secret to Port before creating the synced webhook action:
PAGERDUTY_API_KEY- Your PagerDuty API token.
Set up self-service action
Follow the steps below to create a self-service action that uses a synced webhook.
-
Go to the Self-service page of your portal.
-
Click on the + New Action button.
-
Click on the
{...} Edit JSONbutton. -
Copy and paste the following JSON configuration into the editor:
Acknowledge incident webhook action (Click to expand)
{"identifier": "pagerdutyIncident_acknowledge_incident_webhook","title": "Acknowledge incident (webhook)","icon": "pagerduty","description": "Acknowledge a PagerDuty incident using a synced webhook","trigger": {"type": "self-service","operation": "DAY-2","userInputs": {"properties": {"from": {"icon": "User","title": "From","description": "User email","type": "string","format": "user"}},"required": ["from"],"order": ["from"]},"blueprintIdentifier": "pagerdutyIncident"},"invocationMethod": {"type": "WEBHOOK","url": "https://api.pagerduty.com/incidents","agent": false,"synchronized": true,"method": "PUT","headers": {"Content-Type": "application/json","Accept": "application/vnd.pagerduty+json;version=2","Authorization": "Token token={{.secrets.PAGERDUTY_API_KEY}}","From": "{{.inputs.from}}"},"body": {"incidents": [{"id": "{{.entity.identifier}}","type": "incident_reference","status": "acknowledged"}]}},"requiredApproval": false} -
Click Save to create the action.
Create automation
Create an automation that updates the PagerDuty incident entity in Port after the synced webhook action succeeds.
-
Go to the Automations page of your portal.
-
Click on the + Automation button.
-
Copy and paste the following JSON configuration into the editor:
Sync acknowledged PagerDuty incident automation (Click to expand)
{"identifier": "pagerdutyIncident_sync_acknowledged_status","title": "Sync acknowledged PagerDuty incident status","description": "Update PagerDuty incident data in Port after acknowledgment","trigger": {"type": "automation","event": {"type": "RUN_UPDATED","actionIdentifier": "pagerdutyIncident_acknowledge_incident_webhook"},"condition": {"type": "JQ","expressions": [".diff.after.status == \"SUCCESS\""],"combinator": "and"}},"invocationMethod": {"type": "UPSERT_ENTITY","blueprintIdentifier": "pagerdutyIncident","mapping": {"identifier": "{{.event.diff.after.entity.identifier}}","title": "{{ .event.diff.after.entity.title }}","properties": {"status": "{{.event.diff.after.response.incidents.0.status}}","url": "{{.event.diff.after.response.incidents.0.self}}","urgency": "{{.event.diff.after.response.incidents.0.urgency}}","responder": "{{.event.diff.after.response.incidents.0.assignments.0.assignee.summary}}","escalation_policy": "{{.event.diff.after.response.incidents.0.escalation_policy.summary}}","created_at": "{{.event.diff.after.response.incidents.0.created_at}}","updated_at": "{{.event.diff.after.response.incidents.0.updated_at}}"},"relations": {"pagerdutyService": ["{{.event.diff.after.response.incidents.0.service.id}}"]}}},"publish": true} -
Click Save to create the automation.
Test the flow
-
Go to the Self-service page of your portal.
-
Click the Acknowledge incident (webhook) action.
-
Choose the PagerDuty incident you want to acknowledge.
-
Enter the email address of a valid PagerDuty user.
-
Click Execute.
-
Confirm that the incident status changes to
acknowledgedin PagerDuty and Port.
Add GitHub secrets
In your GitHub repository, go to Settings > Secrets and add the following secrets:
PAGERDUTY_API_KEY- Your PagerDuty API token.PORT_CLIENT_ID- Your Port client ID. See the Port API credentials documentation.PORT_CLIENT_SECRET- Your Port client secret. See the Port API credentials documentation.
Create the GitHub workflow
Create the file .github/workflows/acknowledge-incident.yaml in the .github/workflows folder of your repository.
We recommend creating a dedicated repository for the workflows that are used by Port actions.
Acknowledge incident GitHub workflow (Click to expand)
name: Acknowledge incident in PagerDuty
on:
workflow_dispatch:
inputs:
from:
description: The email address of a valid user associated with the account making the request.
required: true
type: string
port_context:
required: true
description: Includes blueprint, run ID, and entity identifier from Port.
jobs:
acknowledge_incident:
runs-on: ubuntu-latest
steps:
- name: Log acknowledge incident request
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "About to make a request to PagerDuty..."
- name: Acknowledge incident in PagerDuty
id: acknowledge_incident
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.pagerduty.com/incidents'
method: 'PUT'
customHeaders: '{"Content-Type": "application/json", "Accept": "application/vnd.pagerduty+json;version=2", "Authorization": "Token token=${{ secrets.PAGERDUTY_API_KEY }}", "From": "${{ github.event.inputs.from }}"}'
data: >-
{
"incidents": [
{
"id": "${{ fromJson(inputs.port_context).entity }}",
"type": "incident_reference",
"status": "acknowledged"
}
]
}
- name: Log acknowledge incident request failure
if: failure()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "Request to acknowledge incident failed ..."
- name: Log before upserting entity
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "Reporting the updated incident back to Port ..."
- name: Upsert incident entity
uses: port-labs/port-github-action@v1
with:
identifier: "${{ fromJson(steps.acknowledge_incident.outputs.response).incidents[0].id }}"
title: "${{ fromJson(steps.acknowledge_incident.outputs.response).incidents[0].title }}"
blueprint: ${{fromJson(inputs.port_context).blueprint}}
properties: |-
{
"status": "${{ fromJson(steps.acknowledge_incident.outputs.response).incidents[0].status }}",
"url": "${{ fromJson(steps.acknowledge_incident.outputs.response).incidents[0].self }}",
"urgency": "${{ fromJson(steps.acknowledge_incident.outputs.response).incidents[0].urgency }}",
"responder": "${{ fromJson(steps.acknowledge_incident.outputs.response).incidents[0].assignments[0].assignee.summary}}",
"escalation_policy": "${{ fromJson(steps.acknowledge_incident.outputs.response).incidents[0].escalation_policy.summary }}",
"created_at": "${{ fromJson(steps.acknowledge_incident.outputs.response).incidents[0].created_at }}",
"updated_at": "${{ fromJson(steps.acknowledge_incident.outputs.response).incidents[0].updated_at }}"
}
relations: "${{ toJson(fromJson(inputs.port_context).relations) }}"
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: UPSERT
runId: ${{fromJson(inputs.port_context).run_id}}
- name: Log upsert entity failure
if: failure()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "Failed to upsert PagerDuty incident to Port ..."
- name: Log after upserting entity
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "Entity upsert succeeded."
Set up self-service action
Follow the steps below to create a self-service action that triggers the GitHub workflow.
-
Go to the Self-service page of your portal.
-
Click on the + New Action button.
-
Click on the
{...} Edit JSONbutton. -
Copy and paste the following JSON configuration into the editor:
- GitHub (Ocean)
- GitHub (Sunset)
Replace the variables<GITHUB_ORG>- your GitHub organization or user name.<GITHUB_REPO>- your GitHub repository name.<YOUR_GITHUB_OCEAN_INTEGRATION_ID>- your GitHub Ocean integration installation ID.
GitHub Ocean action (Click to expand)
{"identifier": "pagerdutyIncident_acknowledge_incident","title": "Acknowledge incident","icon": "pagerduty","description": "Acknowledge a PagerDuty incident","trigger": {"type": "self-service","operation": "DAY-2","userInputs": {"properties": {"from": {"icon": "User","title": "From","description": "User email","type": "string","format": "user"}},"required": ["from"],"order": ["from"]},"blueprintIdentifier": "pagerdutyIncident"},"invocationMethod": {"type": "INTEGRATION_ACTION","installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>","integrationActionType": "dispatch_workflow","integrationActionExecutionProperties": {"org": "<GITHUB-ORG>","repo": "<GITHUB-REPO-NAME>","workflow": "acknowledge-incident.yaml","workflowInputs": {"from": "{{.inputs.\"from\"}}","port_context": {"blueprint": "{{.action.blueprint}}","entity": "{{.entity.identifier}}","run_id": "{{.run.id}}","relations": "{{.entity.relations}}"}},"reportWorkflowStatus": true}},"requiredApproval": false}Modification RequiredMake sure to replace
<GITHUB_ORG>and<GITHUB_REPO>with your GitHub organization and repository names respectively.GitHub action (Click to expand)
{"identifier": "pagerdutyIncident_acknowledge_incident","title": "Acknowledge incident","icon": "pagerduty","description": "Acknowledge a PagerDuty incident","trigger": {"type": "self-service","operation": "DAY-2","userInputs": {"properties": {"from": {"icon": "User","title": "From","description": "User email","type": "string","format": "user"}},"required": ["from"],"order": ["from"]},"blueprintIdentifier": "pagerdutyIncident"},"invocationMethod": {"type": "GITHUB","org": "<GITHUB_ORG>","repo": "<GITHUB_REPO>","workflow": "acknowledge-incident.yaml","workflowInputs": {"from": "{{.inputs.\"from\"}}","port_context": {"blueprint": "{{.action.blueprint}}","entity": "{{.entity.identifier}}","run_id": "{{.run.id}}","relations": "{{.entity.relations}}"}},"reportWorkflowStatus": true},"requiredApproval": false} -
Click Save to create the action.
Test the flow
-
Go to the Self-service page of your portal.
-
Click the Acknowledge incident action.
-
Choose the PagerDuty incident you want to acknowledge.
-
Enter the email address of a valid PagerDuty user.
-
Click Execute.
-
Confirm that the incident status changes to
acknowledgedin PagerDuty and Port.
Escalate incidents
Escalating an incident updates its escalation policy and urgency in PagerDuty, then syncs the latest incident details back to Port.
- Synced webhook
- GitHub workflow
Add Port secrets
If you have already installed Port's PagerDuty integration, these secrets should already exist in your portal.
To view your existing secrets:
- In your Port application, click on your profile picture
.
- Choose Credentials, then click on the
Secretstab.
Add the following secret to Port before creating the synced webhook action:
PAGERDUTY_API_KEY- Your PagerDuty API token.
Set up self-service action
Follow the steps below to create a self-service action that uses a synced webhook.
-
Go to the Self-service page of your portal.
-
Click on the + New Action button.
-
Click on the
{...} Edit JSONbutton. -
Copy and paste the following JSON configuration into the editor:
Escalate incident webhook action (Click to expand)
{"identifier": "pagerdutyIncident_escalate_incident_webhook","title": "Escalate incident (webhook)","icon": "pagerduty","description": "Escalate a PagerDuty incident","trigger": {"type": "self-service","operation": "DAY-2","userInputs": {"properties": {"escalation_policy_id": {"title": "Escalation policy ID","description": "PagerDuty escalation policy ID (e.g., P7LVMYP)","icon": "pagerduty","type": "string"},"urgency": {"icon": "pagerduty","title": "Urgency","description": "New urgency level for the incident","type": "string","default": "low","enum": ["high","low"],"enumColors": {"high": "orange","low": "lightGray"}},"from": {"icon": "User","title": "From","description": "The email address of a valid PagerDuty user associated with the account making the request.","type": "string","format": "user","default": {"jqQuery": ".user.email"}}},"required": ["escalation_policy_id","urgency","from"],"order": ["escalation_policy_id","urgency","from"]},"blueprintIdentifier": "pagerdutyIncident"},"invocationMethod": {"type": "WEBHOOK","url": "https://api.pagerduty.com/incidents/{{.entity.identifier}}","agent": false,"synchronized": true,"method": "PUT","headers": {"Authorization": "Token token={{.secrets.PAGERDUTY_API_KEY}}","Accept": "application/vnd.pagerduty+json;version=2","From": "{{.inputs.from}}","Content-Type": "application/json"},"body": {"incident": {"type": "incident_reference","escalation_policy": {"id": "{{.inputs.escalation_policy_id}}","type": "escalation_policy_reference"},"urgency": "{{.inputs.urgency}}"}}},"requiredApproval": false} -
Click Save to create the action.
Create automation
Create an automation that updates the PagerDuty incident entity in Port after the synced webhook action succeeds.
-
Go to the Automations page of your portal.
-
Click on the + Automation button.
-
Copy and paste the following JSON configuration into the editor:
Sync escalated PagerDuty incident automation (Click to expand)
{"identifier": "pagerdutyIncident_sync_escalated_status","title": "Sync escalated PagerDuty incident status","description": "Update PagerDuty incident data in Port after escalation","trigger": {"type": "automation","event": {"type": "RUN_UPDATED","actionIdentifier": "pagerdutyIncident_escalate_incident_webhook"},"condition": {"type": "JQ","expressions": [".diff.after.status == \"SUCCESS\""],"combinator": "and"}},"invocationMethod": {"type": "UPSERT_ENTITY","blueprintIdentifier": "pagerdutyIncident","mapping": {"identifier": "{{.event.diff.after.response.incident.id}}","title": "{{.event.diff.after.response.incident.title}}","properties": {"status": "{{.event.diff.after.response.incident.status}}","url": "{{.event.diff.after.response.incident.self}}","urgency": "{{.event.diff.after.response.incident.urgency}}","responder": "{{.event.diff.after.response.incident.assignments.0.assignee.summary}}","escalation_policy": "{{.event.diff.after.response.incident.escalation_policy.summary}}","created_at": "{{.event.diff.after.response.incident.created_at}}","updated_at": "{{.event.diff.after.response.incident.updated_at}}"},"relations": {"pagerdutyService": ["{{.event.diff.after.response.incident.service.id}}"]}}},"publish": true} -
Click Save to create the automation.
Test the flow
-
Go to the Self-service page of your portal.
-
Click the Escalate incident (webhook) action.
-
Choose the PagerDuty incident you want to escalate.
-
Enter the escalation policy ID, urgency level, and email address of a valid PagerDuty user.
-
Click Execute.
-
Confirm that the incident escalation policy and urgency are updated in PagerDuty and Port.
Add GitHub secrets
In your GitHub repository, go to Settings > Secrets and add the following secrets:
PAGERDUTY_API_KEY- Your PagerDuty API token.PORT_CLIENT_ID- Your Port client ID. See the Port API credentials documentation.PORT_CLIENT_SECRET- Your Port client secret. See the Port API credentials documentation.
Create the GitHub workflow
Create the file .github/workflows/escalate-incident.yaml in the .github/workflows folder of your repository.
We recommend creating a dedicated repository for the workflows that are used by Port actions.
Escalate incident GitHub workflow (Click to expand)
name: Escalate PagerDuty incident
on:
workflow_dispatch:
inputs:
escalation_policy_id:
description: PagerDuty escalation policy ID to apply
required: true
type: string
urgency:
description: New urgency level for the incident (e.g., "high")
required: false
type: string
from:
description: The email address of a valid user associated with the account making the request.
required: true
type: string
port_context:
required: true
description: Includes blueprint, run ID, and entity identifier from Port.
jobs:
escalate-incident:
runs-on: ubuntu-latest
steps:
- name: Log escalate incident request
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "About to escalate incident in PagerDuty..."
- name: Escalate incident in PagerDuty
id: escalate_incident
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.pagerduty.com/incidents/${{fromJson(inputs.port_context).entity}}'
method: 'PUT'
customHeaders: '{"Content-Type": "application/json", "Accept": "application/vnd.pagerduty+json;version=2", "Authorization": "Token token=${{ secrets.PAGERDUTY_API_KEY }}", "From": "${{ github.event.inputs.from }}"}'
data: >-
{
"incident": {
"type": "incident_reference",
"escalation_policy": {
"id": "${{ github.event.inputs.escalation_policy_id }}",
"type": "escalation_policy_reference"
},
"urgency": "${{ github.event.inputs.urgency }}"
}
}
- name: Log escalate incident request failure
if: failure()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "Request to escalate incident failed ..."
- name: Log before upserting entity
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "Reporting the escalated incident back to Port ..."
- name: Upsert PagerDuty incident in Port
id: upsert_entity
uses: port-labs/port-github-action@v1
with:
identifier: "${{ fromJson(steps.escalate_incident.outputs.response).incident.id }}"
title: "${{ fromJson(steps.escalate_incident.outputs.response).incident.title }}"
blueprint: ${{fromJson(inputs.port_context).blueprint}}
properties: |-
{
"status": "${{ fromJson(steps.escalate_incident.outputs.response).incident.status }}",
"url": "${{ fromJson(steps.escalate_incident.outputs.response).incident.self }}",
"urgency": "${{ fromJson(steps.escalate_incident.outputs.response).incident.urgency }}",
"responder": "${{ fromJson(steps.escalate_incident.outputs.response).incident.assignments[0].assignee.summary}}",
"escalation_policy": "${{ fromJson(steps.escalate_incident.outputs.response).incident.escalation_policy.summary }}",
"created_at": "${{ fromJson(steps.escalate_incident.outputs.response).incident.created_at }}",
"updated_at": "${{ fromJson(steps.escalate_incident.outputs.response).incident.updated_at }}"
}
relations: "${{ toJson(fromJson(inputs.port_context).relations) }}"
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: UPSERT
runId: ${{fromJson(inputs.port_context).run_id}}
- name: Log upsert entity failure
if: steps.upsert_entity.outcome == 'failure'
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "Failed to report the escalated incident back to Port ..."
- name: Log escalation completion
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "Incident escalation process succeeded."
Set up self-service action
Follow the steps below to create a self-service action that triggers the GitHub workflow.
-
Go to the Self-service page of your portal.
-
Click on the + New Action button.
-
Click on the
{...} Edit JSONbutton. -
Copy and paste the following JSON configuration into the editor:
- GitHub (Ocean)
- GitHub (Sunset)
Replace the variables<GITHUB_ORG>- your GitHub organization or user name.<GITHUB_REPO>- your GitHub repository name.<YOUR_GITHUB_OCEAN_INTEGRATION_ID>- your GitHub Ocean integration installation ID.
GitHub Ocean action (Click to expand)
{"identifier": "pagerdutyIncident_escalate_incident","title": "Escalate incident","icon": "pagerduty","description": "Escalate a PagerDuty incident","trigger": {"type": "self-service","operation": "DAY-2","userInputs": {"properties": {"escalation_policy_id": {"title": "Escalation policy ID","description": "PagerDuty escalation policy ID to apply","icon": "pagerduty","type": "string"},"urgency": {"icon": "pagerduty","title": "Urgency","description": "New urgency level for the incident (e.g., \"high\")","type": "string","default": "low","enum": ["high","low"],"enumColors": {"high": "orange","low": "lightGray"}},"from": {"icon": "User","title": "From","description": "The email address of a valid PagerDuty user associated with the account making the request.","type": "string","format": "user"}},"required": ["escalation_policy_id","urgency","from"],"order": ["escalation_policy_id","urgency","from"]},"blueprintIdentifier": "pagerdutyIncident"},"invocationMethod": {"type": "INTEGRATION_ACTION","installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>","integrationActionType": "dispatch_workflow","integrationActionExecutionProperties": {"org": "<GITHUB-ORG>","repo": "<GITHUB-REPO-NAME>","workflow": "escalate-incident.yaml","workflowInputs": {"escalation_policy_id": "{{.inputs.\"escalation_policy_id\"}}","urgency": "{{.inputs.\"urgency\"}}","from": "{{.inputs.\"from\"}}","port_context": {"blueprint": "{{.action.blueprint}}","entity": "{{.entity.identifier}}","run_id": "{{.run.id}}","relations": "{{.entity.relations}}"}},"reportWorkflowStatus": true}},"requiredApproval": false}Modification RequiredMake sure to replace
<GITHUB_ORG>and<GITHUB_REPO>with your GitHub organization and repository names respectively.GitHub action (Click to expand)
{"identifier": "pagerdutyIncident_escalate_incident","title": "Escalate incident","icon": "pagerduty","description": "Escalate a PagerDuty incident","trigger": {"type": "self-service","operation": "DAY-2","userInputs": {"properties": {"escalation_policy_id": {"title": "Escalation policy ID","description": "PagerDuty escalation policy ID to apply","icon": "pagerduty","type": "string"},"urgency": {"icon": "pagerduty","title": "Urgency","description": "New urgency level for the incident (e.g., \"high\")","type": "string","default": "low","enum": ["high","low"],"enumColors": {"high": "orange","low": "lightGray"}},"from": {"icon": "User","title": "From","description": "The email address of a valid PagerDuty user associated with the account making the request.","type": "string","format": "user"}},"required": ["escalation_policy_id","urgency","from"],"order": ["escalation_policy_id","urgency","from"]},"blueprintIdentifier": "pagerdutyIncident"},"invocationMethod": {"type": "GITHUB","org": "<GITHUB_ORG>","repo": "<GITHUB_REPO>","workflow": "escalate-incident.yaml","workflowInputs": {"escalation_policy_id": "{{.inputs.\"escalation_policy_id\"}}","urgency": "{{.inputs.\"urgency\"}}","from": "{{.inputs.\"from\"}}","port_context": {"blueprint": "{{.action.blueprint}}","entity": "{{.entity.identifier}}","run_id": "{{.run.id}}","relations": "{{.entity.relations}}"}},"reportWorkflowStatus": true},"requiredApproval": false} -
Click Save to create the action.
Test the flow
-
Go to the Self-service page of your portal.
-
Click the Escalate incident action.
-
Choose the PagerDuty incident you want to escalate.
-
Enter the escalation policy ID, urgency level, and email address of a valid PagerDuty user.
-
Click Execute.
-
Confirm that the incident escalation policy and urgency are updated in PagerDuty and Port.
Resolve incidents
Resolving an incident changes its status in PagerDuty to resolved and syncs the updated incident entity back to Port.
- Synced webhook
- GitHub workflow
Add Port secrets
If you have already installed Port's PagerDuty integration, these secrets should already exist in your portal.
To view your existing secrets:
- In your Port application, click on your profile picture
.
- Choose Credentials, then click on the
Secretstab.
Add the following secret to Port before creating the synced webhook action:
PAGERDUTY_API_KEY- Your PagerDuty API token.
Set up self-service action
Follow the steps below to create a self-service action that uses a synced webhook.
-
Go to the Self-service page of your portal.
-
Click on the + New Action button.
-
Click on the
{...} Edit JSONbutton. -
Copy and paste the following JSON configuration into the editor:
Resolve incident webhook action (Click to expand)
{"identifier": "pagerdutyIncident_resolve_incident_webhook","title": "Resolve incident (webhook)","icon": "pagerduty","description": "Resolve a PagerDuty incident","trigger": {"type": "self-service","operation": "DAY-2","userInputs": {"properties": {"from": {"icon": "User","title": "From","description": "The email address of a valid PagerDuty user associated with the account making the request.","type": "string","format": "user","default": {"jqQuery": ".user.email"}}},"required": ["from"],"order": ["from"]},"blueprintIdentifier": "pagerdutyIncident"},"invocationMethod": {"type": "WEBHOOK","url": "https://api.pagerduty.com/incidents","agent": false,"synchronized": true,"method": "PUT","headers": {"Authorization": "Token token={{.secrets.PAGERDUTY_API_KEY}}","Accept": "application/vnd.pagerduty+json;version=2","From": "{{.inputs.from}}","Content-Type": "application/json"},"body": {"incidents": [{"id": "{{.entity.identifier}}","type": "incident_reference","status": "resolved"}]}},"requiredApproval": false} -
Click Save to create the action.
Create automation
Create an automation that updates the PagerDuty incident entity in Port after the synced webhook action succeeds.
-
Go to the Automations page of your portal.
-
Click on the + Automation button.
-
Copy and paste the following JSON configuration into the editor:
Sync resolved PagerDuty incident automation (Click to expand)
{"identifier": "pagerdutyIncident_sync_resolved_status","title": "Sync resolved PagerDuty incident status","description": "Update PagerDuty incident data in Port after resolution","trigger": {"type": "automation","event": {"type": "RUN_UPDATED","actionIdentifier": "pagerdutyIncident_resolve_incident_webhook"},"condition": {"type": "JQ","expressions": [".diff.after.status == \"SUCCESS\""],"combinator": "and"}},"invocationMethod": {"type": "UPSERT_ENTITY","blueprintIdentifier": "pagerdutyIncident","mapping": {"identifier": "{{.event.diff.after.entity.identifier}}","title": "{{.event.diff.after.entity.title}}","properties": {"status": "resolved","updated_at": "{{.event.diff.after.endedAt}}"}}},"publish": true} -
Click Save to create the automation.
Test the flow
-
Go to the Self-service page of your portal.
-
Click the Resolve incident (webhook) action.
-
Choose the PagerDuty incident you want to resolve.
-
Enter the email address of a valid PagerDuty user.
-
Click Execute.
-
Confirm that the incident status changes to
resolvedin PagerDuty and Port.
Add GitHub secrets
In your GitHub repository, go to Settings > Secrets and add the following secrets:
PAGERDUTY_API_KEY- Your PagerDuty API token.PORT_CLIENT_ID- Your Port client ID. See the Port API credentials documentation.PORT_CLIENT_SECRET- Your Port client secret. See the Port API credentials documentation.
Create the GitHub workflow
Create the file .github/workflows/resolve-incident.yaml in the .github/workflows folder of your repository.
We recommend creating a dedicated repository for the workflows that are used by Port actions.
Resolve incident GitHub workflow (Click to expand)
name: Resolve incident in PagerDuty
on:
workflow_dispatch:
inputs:
from:
description: The email address of a valid user associated with the account making the request.
required: true
type: string
port_context:
required: true
description: Includes blueprint, run ID, and entity identifier from Port.
jobs:
resolve_incident:
runs-on: ubuntu-latest
steps:
- name: Log resolve incident request
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "About to make a request to PagerDuty..."
- name: Resolve incident in PagerDuty
id: resolve_incident
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.pagerduty.com/incidents'
method: 'PUT'
customHeaders: '{"Content-Type": "application/json", "Accept": "application/vnd.pagerduty+json;version=2", "Authorization": "Token token=${{ secrets.PAGERDUTY_API_KEY }}", "From": "${{ github.event.inputs.from }}"}'
data: >-
{
"incidents": [
{
"id": "${{fromJson(inputs.port_context).entity}}",
"type": "incident_reference",
"status": "resolved"
}
]
}
- name: Log before processing incident response
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "Getting incident object from response received ..."
- name: Log before upserting entity
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "Reporting the updated incident back to Port ..."
- name: Upsert incident entity
uses: port-labs/port-github-action@v1
with:
identifier: "${{ fromJson(steps.resolve_incident.outputs.response).incidents[0].id }}"
title: "${{ fromJson(steps.resolve_incident.outputs.response).incidents[0].title }}"
blueprint: ${{fromJson(inputs.port_context).blueprint}}
properties: |-
{
"status": "${{ fromJson(steps.resolve_incident.outputs.response).incidents[0].status }}",
"url": "${{ fromJson(steps.resolve_incident.outputs.response).incidents[0].self }}",
"urgency": "${{ fromJson(steps.resolve_incident.outputs.response).incidents[0].urgency }}",
"responder": "${{ fromJson(steps.resolve_incident.outputs.response).incidents[0].assignments[0].assignee.summary}}",
"escalation_policy": "${{ fromJson(steps.resolve_incident.outputs.response).incidents[0].escalation_policy.summary }}",
"created_at": "${{ fromJson(steps.resolve_incident.outputs.response).incidents[0].created_at }}",
"updated_at": "${{ fromJson(steps.resolve_incident.outputs.response).incidents[0].updated_at }}"
}
relations: "${{ toJson(fromJson(inputs.port_context).relations) }}"
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: UPSERT
runId: ${{fromJson(inputs.port_context).run_id}}
- name: Log after upserting entity
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).run_id}}
logMessage: "Entity upsert succeeded."
Set up self-service action
Follow the steps below to create a self-service action that triggers the GitHub workflow.
-
Go to the Self-service page of your portal.
-
Click on the + New Action button.
-
Click on the
{...} Edit JSONbutton. -
Copy and paste the following JSON configuration into the editor:
- GitHub (Ocean)
- GitHub (Sunset)
Replace the variables<GITHUB_ORG>- your GitHub organization or user name.<GITHUB_REPO>- your GitHub repository name.<YOUR_GITHUB_OCEAN_INTEGRATION_ID>- your GitHub Ocean integration installation ID.
GitHub Ocean action (Click to expand)
{"identifier": "pagerdutyIncident_resolve_incident","title": "Resolve incident","icon": "pagerduty","description": "Resolve a PagerDuty incident","trigger": {"type": "self-service","operation": "DAY-2","userInputs": {"properties": {"from": {"icon": "User","title": "From","description": "User email","type": "string","format": "user"}},"required": ["from"],"order": ["from"]},"blueprintIdentifier": "pagerdutyIncident"},"invocationMethod": {"type": "INTEGRATION_ACTION","installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>","integrationActionType": "dispatch_workflow","integrationActionExecutionProperties": {"org": "<GITHUB-ORG>","repo": "<GITHUB-REPO-NAME>","workflow": "resolve-incident.yaml","workflowInputs": {"from": "{{.inputs.\"from\"}}","port_context": {"blueprint": "{{.action.blueprint}}","entity": "{{.entity.identifier}}","run_id": "{{.run.id}}","relations": "{{.entity.relations}}"}},"reportWorkflowStatus": true}},"requiredApproval": false}Modification RequiredMake sure to replace
<GITHUB_ORG>and<GITHUB_REPO>with your GitHub organization and repository names respectively.GitHub action (Click to expand)
{"identifier": "pagerdutyIncident_resolve_incident","title": "Resolve incident","icon": "pagerduty","description": "Resolve a PagerDuty incident","trigger": {"type": "self-service","operation": "DAY-2","userInputs": {"properties": {"from": {"icon": "User","title": "From","description": "User email","type": "string","format": "user"}},"required": ["from"],"order": ["from"]},"blueprintIdentifier": "pagerdutyIncident"},"invocationMethod": {"type": "GITHUB","org": "<GITHUB_ORG>","repo": "<GITHUB_REPO>","workflow": "resolve-incident.yaml","workflowInputs": {"from": "{{.inputs.\"from\"}}","port_context": {"blueprint": "{{.action.blueprint}}","entity": "{{.entity.identifier}}","run_id": "{{.run.id}}","relations": "{{.entity.relations}}"}},"reportWorkflowStatus": true},"requiredApproval": false} -
Click Save to create the action.
Test the flow
-
Go to the Self-service page of your portal.
-
Click the Resolve incident action.
-
Choose the PagerDuty incident you want to resolve.
-
Enter the email address of a valid PagerDuty user.
-
Click Execute.
-
Confirm that the incident status changes to
resolvedin PagerDuty and Port.