Get the FREE Ultimate OpenClaw Setup Guide →

gh-pr-comment

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

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

  1. Verify auth:
    gh --version
    gh auth status
    
  2. Post a comment:
    gh pr comment 123 --body "LGTM! Ready for merge."
    gh pr comment 123 --body-file review-notes.md
    
  3. Edit or delete your last comment:
    gh pr comment 123 --edit-last --body "Updated: addressed concerns"
    gh pr comment 123 --delete-last --yes
    
  4. Open editor or browser:
    gh pr comment 123 --editor
    gh pr comment 123 --web
    

Examples

# Quick comment
gh pr comment 123 --body "Testing this now."

# Comment from file
gh pr comment 123 --body-file feedback.md

# Edit last comment
gh pr comment 123 --edit-last --body "Actually, found one more issue."

# Delete last comment
gh pr comment 123 --delete-last --yes

# Comment on current branch's PR
gh pr comment --body "Addressed review feedback."

Flags reference

FlagDescription
-b, --bodyComment body text
-F, --body-fileRead body from file (use "-" for stdin)
--edit-lastEdit your last comment
--delete-lastDelete your last comment
--create-if-noneCreate comment if none exists (with --edit-last)
--yesSkip delete confirmation
-e, --editorOpen editor to write comment
-w, --webOpen 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

Source

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

Overview

gh-pr-comment lets you add, edit, or delete comments on a GitHub pull request using the gh CLI. It supports posting new comments, updating existing ones, and removing your own comments, with options to target the last comment or create a comment when none exists.

How This Skill Works

You post comments with gh pr comment <PR> --body 'Text' or --body-file <file>. You can edit or delete your last comment using --edit-last or --delete-last, and you can open an editor or browser with --editor or --web. If no body is provided, an interactive prompt is used to craft the comment.

When to Use It

  • The user asks to comment on a PR.
  • Posting status updates or feedback on a PR.
  • Editing or deleting previous comments.
  • Commenting on the PR from the current branch.
  • Preparing a comment in an editor or browser before posting.

Quick Start

  1. Step 1: Verify authentication with gh --version and gh auth status.
  2. Step 2: Post a comment using gh pr comment <PR> --body 'LGTM! Ready for merge.' or --body-file <file>.
  3. Step 3: Edit or delete your last comment with --edit-last or --delete-last, or open an editor/browser with --editor or --web.

Best Practices

  • Confirm the target PR by number, URL, or branch (or use the current branch PR).
  • Always provide --body or --body-file to avoid interactive prompts in automation.
  • Edit or delete only your own comments; use --edit-last or --delete-last accordingly.
  • Use --create-if-none with --edit-last for idempotent updates.
  • For interactive drafting, use --editor or --web to open an editor or browser.

Example Use Cases

  • 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.'

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers