gh-pr-edit
npx machina-cli add skill dceoy/github-cli-agent-skills/gh-pr-edit --openclawFiles (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
-
Verify auth:
gh --version gh auth status -
View current PR state:
gh pr view 123 --json title,body,labels,assignees,reviewRequests -
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 -
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
| Flag | Description |
|---|---|
-t, --title | Set new title |
-b, --body | Set new body |
-F, --body-file | Read body from file |
-B, --base | Change base branch |
--add-label | Add labels |
--remove-label | Remove labels |
--add-reviewer | Add reviewers |
--remove-reviewer | Remove reviewers |
--add-assignee | Add assignees (@me supported) |
--remove-assignee | Remove assignees |
--add-project | Add to projects |
--remove-project | Remove from projects |
-m, --milestone | Set milestone |
--remove-milestone | Remove milestone |
Notes
- Without arguments, edits current branch's PR.
@meassigns yourself;@copilotsupported on GitHub.com.- Project edits may require
gh auth refresh -s project.
References
- GitHub CLI manual: https://cli.github.com/manual/
gh pr edit --help
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
- Step 1: Verify gh is installed and you are authenticated (gh --version; gh auth status).
- Step 2: View the target PR state (gh pr view 123).
- 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