feat(discussion): add comment command#13620
Open
babakks wants to merge 8 commits into
Open
Conversation
Add client methods for managing discussion comments and replies: - AddComment: creates a top-level comment or reply via addDiscussionComment - UpdateComment: edits a comment body via updateDiscussionComment - DeleteComment: removes a comment via deleteDiscussionComment - GetComment: fetches a comment by node ID with typename validation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Implement gh discussion comment for adding, editing, and deleting comments and replies on discussions. Supports --body, --body-file, --editor for input, --reply-to for threading, --edit and --delete for modifying existing comments, with confirmation prompts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…PI calls Replace gh api graphql addDiscussionComment mutations in view and list acceptance tests with gh discussion comment. Extract comment IDs via a single view call with jq2env instead of multiple calls. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cover add, reply, edit, delete flows including body-file input, non-interactive delete requiring --yes, and deletion of both parent comment and reply to avoid ghost entries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add test for --delete without --yes in non-TTY mode and fix existing delete tests to set isTTY: true for prompter-based confirmation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add ParseDiscussionOrCommentArg to the shared package for parsing discussion numbers, URLs, comment node IDs, and comment URLs (with #discussioncomment-NNNNN fragments). Add ResolveCommentNodeID to the client for constructing node IDs from repository database ID and comment database ID via msgpack encoding. Update the comment command to accept comment URLs as positional args for reply, edit, and delete operations. Update the view command to accept comment URLs in the --replies flag. Add DiscussionID field to DiscussionComment for reply flow (fetches the parent discussion ID from a comment). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ests Update comment acceptance test to use positional comment IDs instead of --reply-to, and add URL-based add/edit/delete test cases. Update view acceptance test to cover --replies with a comment URL. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
BagToad
approved these changes
Jun 9, 2026
BagToad
left a comment
Member
There was a problem hiding this comment.
LGTM - discussed in sync and there's some stuff we want to change but I trust you'll action those :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
gh discussion commentcommandThis PR adds a new
gh discussion commentcommand for managing comments and replies on GitHub Discussions, along with UX improvements to theviewcommand.gh discussion commentThe command supports adding, editing, and deleting comments and replies. The positional argument determines the action context:
Adding a top-level comment:
Replying to a comment (positional arg is a comment ID or URL):
Editing a comment or reply:
Deleting a comment or reply:
When no
--bodyor--body-fileis provided in an interactive terminal, an editor is opened for input. For edits, the editor is pre-populated with the existing comment body.Comment URLs are resolved to node IDs via msgpack encoding of the repository database ID and comment database ID extracted from the URL fragment.
Changes to
gh discussion viewThe
--repliesflag now accepts both comment node IDs and comment URLs:When a URL is provided, the repository and discussion number from the URL override the positional argument.
Tests
commentcommand covering add, reply, edit (including from file), delete (with confirmation prompt check), and URL-based operations.discussion-view.txtar,discussion-list.txtar) to use the newcommentcommand instead of rawgh api graphqlmutations.discussion-view.txtarto verify--repliesworks with a comment URL.