Get the FREE Ultimate OpenClaw Setup Guide →

gh-pr-edit

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

GitHub PR Edit

When to use

  • The user asks to update PR title, body, or metadata.
  • Adding or removing labels, reviewers, or assignees.
  • Changing base branch or milestone.

Inputs to confirm

  • PR number, URL, or branch name (or current branch PR).
  • Changes to apply (title, body, labels, reviewers, etc.).
  • Target repo if not current (--repo OWNER/REPO).

Workflow

  1. Verify auth:

    gh --version
    gh auth status
    
  2. View current PR state:

    gh pr view 123 --json title,body,labels,assignees,reviewRequests
    
  3. Apply edits:

    # Update title and body
    gh pr edit 123 --title "New title" --body "Updated description"
    
    # Manage labels
    gh pr edit 123 --add-label "bug,priority" --remove-label "triage"
    
    # Manage reviewers
    gh pr edit 123 --add-reviewer monalisa,hubot
    gh pr edit 123 --remove-reviewer oldreviewer
    
    # Manage assignees
    gh pr edit 123 --add-assignee "@me" --remove-assignee someone
    
    # Change base branch
    gh pr edit 123 --base develop
    
  4. Verify changes:

    gh pr view 123
    

Examples

# Update title
gh pr edit 123 --title "feat: Add user authentication"

# Add labels and reviewer
gh pr edit 123 --add-label "enhancement" --add-reviewer team-lead

# Assign yourself
gh pr edit 123 --add-assignee "@me"

# Update body from file
gh pr edit 123 --body-file updated-description.md

# Change milestone
gh pr edit 123 --milestone "v2.0"

Flags reference

FlagDescription
-t, --titleSet new title
-b, --bodySet new body
-F, --body-fileRead body from file
-B, --baseChange base branch
--add-labelAdd labels
--remove-labelRemove labels
--add-reviewerAdd reviewers
--remove-reviewerRemove reviewers
--add-assigneeAdd assignees (@me supported)
--remove-assigneeRemove assignees
--add-projectAdd to projects
--remove-projectRemove from projects
-m, --milestoneSet milestone
--remove-milestoneRemove milestone

Notes

  • Without arguments, edits current branch's PR.
  • @me assigns yourself; @copilot supported on GitHub.com.
  • Project edits may require gh auth refresh -s project.

References

Source

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

Overview

This skill enables editing GitHub PR metadata such as title, body, labels, reviewers, assignees, and projects using gh pr edit. It also supports changing the base branch or milestone, helping you keep PRs accurate and up-to-date from the command line.

How This Skill Works

Authenticate and inspect the PR with gh pr view, then apply changes using gh pr edit with appropriate flags (e.g., --title, --body, --add-label, --remove-label, --add-reviewer, --add-assignee, --base, --milestone, --add-project, --remove-project). Target a PR by number, URL, or branch name, and use --repo if editing a non-current repository.

When to Use It

  • When you need to update a PR's title or description.
  • When you need to add or remove labels on a PR.
  • When you need to add or remove reviewers or assignees.
  • When you want to change the base branch.
  • When you want to set or change the milestone or project associations.

Quick Start

  1. Step 1: Verify gh is installed and you are authenticated (gh --version; gh auth status).
  2. Step 2: View the target PR state (gh pr view 123).
  3. Step 3: Apply edits (gh pr edit 123 --title "New title" --body "Updated description" --add-label "bug").

Best Practices

  • Confirm the target PR (number, URL, or branch) and repo with --repo if editing a non-current repo.
  • Check the current PR state with gh pr view before applying edits.
  • Use --body-file for long descriptions to avoid escaping issues.
  • Group related edits in a single gh pr edit command when possible.
  • Verify changes after editing with gh pr view.

Example Use Cases

  • gh pr edit 123 --title "feat: Add user authentication"
  • gh pr edit 123 --add-label "enhancement" --add-reviewer team-lead
  • gh pr edit 123 --add-assignee "@me"
  • gh pr edit 123 --body-file updated-description.md
  • gh pr edit 123 --milestone "v2.0"

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers