Skip to content

feat(gh): add action to edit your own inline review comments - #2959

Open
ccarvalho-eng wants to merge 1 commit into
folke:mainfrom
ccarvalho-eng:feat/gh-edit-comment
Open

ccarvalho-eng wants to merge 1 commit into
folke:mainfrom
ccarvalho-eng:feat/gh-edit-comment

Conversation

@ccarvalho-eng

Copy link
Copy Markdown

There's currently no way to edit an inline PR review comment from the picker — only to add one (gh_diff_comment) or reply (gh_reply_to_comment). This adds gh_edit_comment, enabled only when the cursor sits on a comment you authored (viewerDidAuthor).

viewerDidAuthor wasn't previously requested for individual review comments in the GraphQL query (only at the review level), so this adds it there too.

A subtlety worth flagging for review: comment_id (used by gh_reply_to_comment) always resolves to a thread's root comment, because GitHub's reply endpoint requires anchoring to the root regardless of which reply you're looking at. Editing needs the exact comment under the cursor, not the thread root, so this adds a separate edit_comment_id tag in the renderer that covers only that comment's own lines (header + body), not the lines belonging to any nested replies rendered beneath it.

The edit itself reuses the existing scratch-buffer edit flow (edit = "body-file"), prefilled with the comment's current body, and submits a PATCH /repos/{owner}/{repo}/pulls/comments/{id} with the new body.

Adds gh_edit_comment, enabled when the cursor is on a comment you
authored (viewerDidAuthor). Reuses the existing scratch-buffer edit
flow, prefilled with the comment's current body, and PATCHes
/repos/{repo}/pulls/comments/{id} on submit.

comment_id (used by gh_reply_to_comment) always resolves to a
thread's root comment, since GitHub's reply endpoint requires
anchoring to the root. Editing needs the exact comment under the
cursor instead, so this adds a separate edit_comment_id tag that
covers only that comment's own lines, not lines belonging to nested
replies rendered beneath it.

viewerDidAuthor wasn't previously fetched for individual review
comments (only at the review level), so the GraphQL query for inline
comments now requests it too.
@github-actions github-actions Bot added the size/l Large PR (<100 lines changed) label Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l Large PR (<100 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant