Skip to content

maxbeizer/gh-pagerduty

Repository files navigation

gh-pagerduty

A GitHub CLI extension for interacting with PagerDuty.

Check on-call status, view schedules, list incidents, and more — all from the terminal.

Installation

gh extension install maxbeizer/gh-pagerduty

Authentication

Configuration can be set via environment variables or a config file. Environment variables always take precedence.

Option 1: Environment variables

export PAGERDUTY_API_TOKEN="your-token-here"
export PAGERDUTY_API_HOST="https://api.eu.pagerduty.com"  # optional, for EU accounts

Option 2: Config file

Create ~/.config/gh-pagerduty/config.yml, or run gh pagerduty setup for interactive configuration:

api_token: your-token-here
api_host: https://api.pagerduty.com  # optional, defaults to US

# Scope commands to resources you care about (optional)
# These are used as defaults — CLI flags always override them.
schedule_ids:
  - SCHEDULE_ID_1
  - SCHEDULE_ID_2
service_ids:
  - SERVICE_ID_1
team_ids:
  - TEAM_ID_1

Get a token at: PagerDuty API Access Keys

For EU accounts, also set:

export PAGERDUTY_API_HOST="https://api.eu.pagerduty.com"

Or add api_host to your config file (see above).

Usage

Am I on call?

gh pagerduty oncall           # Am I currently on call?
gh pagerduty oncall --all     # Who is on call across all schedules?
gh pagerduty oncall --next    # Calendar view of your upcoming shifts (next 30 days)
gh pagerduty oncall --schedule SCHED_ID  # Who is on call for a specific schedule?
gh pagerduty oncall --level 0            # Show all escalation levels (default: L1 only)
gh pagerduty oncall --json               # Machine-readable output

Example --next output:

📅 Your on-call shifts (next 30 days)

  Week of Mar 10 – Mar 16
    Mon Mar 10  09:00 – Tue Mar 11  09:00  (1d)  Primary On-Call
    Thu Mar 13  17:00 – Fri Mar 14  09:00  (16h)  After-Hours

  Week of Mar 24 – Mar 30
    Mon Mar 24  09:00 – Tue Mar 25  09:00  (1d)  Primary On-Call

Schedules

gh pagerduty schedule list                # List all schedules
gh pagerduty schedule show SCHED_ID       # Show schedule details & upcoming shifts
gh pagerduty schedule show SCHED_ID --since 2025-01-01T00:00:00Z --until 2025-01-08T00:00:00Z

Incidents

gh pagerduty incidents                        # List open incidents
gh pagerduty incidents --status resolved      # List resolved incidents
gh pagerduty incidents --urgency high         # Only high-urgency
gh pagerduty incidents --service SVC_ID       # Filter by service
gh pagerduty incidents --since 2025-01-01T00:00:00Z

Services

gh pagerduty services              # List all services
gh pagerduty services --team TEAM_ID  # Filter by team

Current user

gh pagerduty me    # Show your PagerDuty user info

Version

gh pagerduty version

Development

make help          # see all targets
make build         # build binary
make test          # run tests
make ci            # build + vet + test-race
make install-local # install extension from checkout
make relink-local  # reinstall after changes

Releasing

Tag a version to trigger a release build:

git tag v0.1.0
git push origin v0.1.0

The GitHub Actions workflow uses goreleaser to build binaries for darwin/linux (amd64/arm64) and create a GitHub release. Once released, users install with:

gh extension install maxbeizer/gh-pagerduty

About

GitHub CLI extension for PagerDuty — check on-call status, view schedules, list incidents, and more

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages