Get the FREE Ultimate OpenClaw Setup Guide →

gh-pr-list

npx machina-cli add skill dceoy/github-cli-agent-skills/gh-pr-list --openclaw
Files (1)
SKILL.md
2.6 KB

GitHub PR List

When to use

  • The user asks to list pull requests in a repository.
  • You need to find PRs by author, label, state, or search query.
  • Checking overall PR backlog or finding specific PRs.

Inputs to confirm

  • Filter criteria: state (open/closed/merged/all), author, assignee, labels.
  • Search query if advanced filtering needed.
  • Target repo if not current (--repo OWNER/REPO).
  • Output format (table, JSON, web).

Workflow

  1. Verify auth:
    gh --version
    gh auth status
    
  2. List PRs with filters:
    gh pr list
    gh pr list --state all --limit 50
    gh pr list --author "@me"
    gh pr list --label "bug" --label "priority"
    gh pr list --assignee "@me" --state open
    
  3. Use search syntax for advanced queries:
    gh pr list --search "status:success review:required"
    gh pr list --search "draft:false review:approved"
    
  4. Get JSON output for scripting:
    gh pr list --json number,title,state,author --jq '.[] | "\(.number): \(.title)"'
    

Examples

# List your open PRs
gh pr list --author "@me"

# Find PRs needing review
gh pr list --search "review:required"

# List merged PRs to main
gh pr list --state merged --base main --limit 20

# Get PR numbers and titles as JSON
gh pr list --json number,title,reviewDecision

Flags reference

FlagDescription
-s, --stateFilter: open, closed, merged, all (default: open)
-A, --authorFilter by author
-a, --assigneeFilter by assignee
-l, --labelFilter by label (repeatable)
-B, --baseFilter by base branch
-H, --headFilter by head branch
-S, --searchSearch with GitHub query syntax
-L, --limitMax items to fetch (default 30)
--jsonOutput specific fields as JSON
-w, --webOpen list in browser

References

Source

git clone https://github.com/dceoy/github-cli-agent-skills/blob/main/skills/gh-pr-list/SKILL.mdView on GitHub

Overview

This skill uses the GitHub CLI (gh) to list pull requests with filters like state, author, assignee, and labels, and supports advanced search queries. It helps you surface PRs in a repo or backlog and export results for automation.

How This Skill Works

You run gh pr list with various flags (e.g., --state, --author, --label, --assignee, --base, --head, --search, --limit) to narrow results. For scripting, use --json to fetch structured fields and optionally pipe through --jq for formatting. If you’re not in the repo root, supply --repo OWNER/REPO.

When to Use It

  • When you need to list pull requests in a repository
  • When you need to find PRs by author, label, state, or a search query
  • When analyzing overall PR backlog or locating specific PRs
  • When you’re not in the repo’s directory and must specify the repo with --repo
  • When you want structured output for automation using --json (and --jq)

Quick Start

  1. Step 1: Verify gh is ready: gh --version and gh auth status
  2. Step 2: List PRs with basic filters, e.g., gh pr list --state open --author "@me"
  3. Step 3: Get JSON output for scripting with --json, e.g., gh pr list --json number,title,state

Best Practices

  • Combine multiple labels with repeated --label calls to intersect filters
  • Use --state all or merged to see completed PRs alongside open ones
  • Use --author "@me" or --assignee "@me" to focus on your PRs
  • Export data with --json and format with --jq for scripting
  • Always verify authentication with gh auth status before listing PRs

Example Use Cases

  • gh pr list --author "@me"
  • gh pr list --search "review:required"
  • gh pr list --state merged --base main --limit 20
  • gh pr list --json number,title,reviewDecision
  • gh pr list --label "bug" --label "priority"

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers