| name | gh-pr-comment |
| description | Add, edit, or delete comments on a GitHub pull request using gh CLI. |
| allowed-tools | Bash, Read, Grep |
GitHub PR Comment
When to use
- The user asks to comment on a PR.
- Posting status updates or feedback on a PR.
- Editing or deleting previous comments.
Inputs to confirm
- PR number, URL, or branch name (or current branch PR).
- Comment body text or file.
- Whether to edit or delete last comment.
Workflow
- Verify auth:
gh --version
gh auth status
- Post a comment:
gh pr comment 123 --body "LGTM! Ready for merge."
gh pr comment 123 --body-file review-notes.md
- Edit or delete your last comment:
gh pr comment 123 --edit-last --body "Updated: addressed concerns"
gh pr comment 123 --delete-last --yes
- Open editor or browser:
gh pr comment 123 --editor
gh pr comment 123 --web
Examples
gh pr comment 123 --body "Testing this now."
gh pr comment 123 --body-file feedback.md
gh pr comment 123 --edit-last --body "Actually, found one more issue."
gh pr comment 123 --delete-last --yes
gh pr comment --body "Addressed review feedback."
Flags reference
| Flag | Description |
|---|
-b, --body | Comment body text |
-F, --body-file | Read body from file (use "-" for stdin) |
--edit-last | Edit your last comment |
--delete-last | Delete your last comment |
--create-if-none | Create comment if none exists (with --edit-last) |
--yes | Skip delete confirmation |
-e, --editor | Open editor to write comment |
-w, --web | Open browser to write comment |
Notes
- Without
--body or --body-file, opens interactive prompt.
- Only your own comments can be edited/deleted.
- Use
--create-if-none with --edit-last for idempotent updates.
References