Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
51b7653
feat(discussion/client): add discussion client package
babakks Jun 1, 2026
d3a1538
feat(discussion/shared): add shared utilities for discussion commands
babakks Jun 1, 2026
8b73951
feat(discussion list): add discussion list command
babakks Jun 1, 2026
57008e7
feat(discussion view): add discussion view command
babakks Jun 1, 2026
7bd67a8
feat(discussion create): add discussion create command
babakks Jun 1, 2026
797effe
feat(discussion edit): add discussion edit command
babakks Jun 1, 2026
dc5d7c1
fix(discussion): various polish and small fixes
babakks Jun 4, 2026
0d93148
refactor(discussion): extract command-level consts for enums
babakks Jun 4, 2026
97b2296
refactor(discussion list): make pager call/error consistent with view…
babakks Jun 4, 2026
dcd3507
docs(discussion/client): add godoc to exported consts
babakks Jun 4, 2026
d6a089d
chore(discussion/client): fix formatting
babakks Jun 4, 2026
b102900
fix(discussion): handle partial failure on create/update label mutations
babakks Jun 5, 2026
6dcb0b0
docs(discussion view): improve long help text for clarity
babakks Jun 5, 2026
fbd733e
refactor(discussion): add Cursor field and ExportData to DiscussionLi…
babakks Jun 5, 2026
e104885
refactor(discussion/client): precheck discussions enabled via getRepo…
babakks Jun 5, 2026
ca8e126
fix(discussion list): print "answered" instead of checkmark in non-tt…
babakks Jun 5, 2026
ada8583
test(discussion): add acceptance tests for discussion commands
babakks Jun 5, 2026
8ec0830
docs(acceptance): add new jq2env and jq-assert functions
babakks Jun 5, 2026
f147d02
test(discussion list): consolidate tests into table-driven format
babakks Jun 5, 2026
e61df07
Merge branch 'trunk' into feature/discussion
babakks Jun 5, 2026
c1f3c1a
fix(discussion): add missing repo flag override
babakks Jun 8, 2026
9d413e7
test(discussion list): rename TestNewCmdList2 to TestNewCmdList
babakks Jun 9, 2026
e2d150d
fix(discussion): remove redundant error wrapping on ListCategories
babakks Jun 9, 2026
95fc89c
chore(discussion): remove unused HttpClient field from create and edit
babakks Jun 9, 2026
4166ecf
chore: apply formatting
babakks Jun 9, 2026
2618999
feat(discussion/client): add comment manipulation methods
babakks Jun 6, 2026
6f5e114
feat(discussion): add discussion comment command
babakks Jun 8, 2026
82ac0d7
refactor(acceptance): use discussion comment command instead of raw A…
babakks Jun 8, 2026
2629753
test(acceptance): add discussion comment acceptance test
babakks Jun 8, 2026
61a4476
test(discussion comment): add non-tty delete flag validation test case
babakks Jun 8, 2026
d026f8f
feat(discussion): support comment URLs in --replies and comment command
babakks Jun 8, 2026
6394ca8
test(acceptance): cover discussion comment URLs in comment and view t…
babakks Jun 8, 2026
bc7ed48
chore: fix formatting
babakks Jun 8, 2026
55928c9
refactor(discussion view): replace --replies flag with positional com…
babakks Jun 10, 2026
8747c69
refactor(discussion/client): take host instead of repo in GetComment
babakks Jun 10, 2026
869c044
test(acceptance): use positional comment argument in discussion view …
babakks Jun 10, 2026
8d2b059
fix(discussion view): error when --comments is used with a comment ar…
babakks Jun 10, 2026
42db02d
Merge pull request #13620 from cli/babakks/add-discussion-comment
babakks Jun 10, 2026
27aabfa
fix(discussion view): use color scheme method for success icon
babakks Jun 10, 2026
951d76e
refactor(discussion list): simplify no-results message and use succes…
babakks Jun 10, 2026
9f2da11
fix(discussion view): show comments and replies in chronological order
babakks Jun 10, 2026
06d2e34
docs(discussion list): clarify answered examples refer to Q&A discuss…
babakks Jun 10, 2026
5d77247
fix(discussion view): print only requested items in non-tty output
babakks Jun 10, 2026
d63ab8d
fix(discussion/shared): error on out-of-range discussion number in URL
babakks Jun 10, 2026
5e6a58b
test(acceptance): fix discussion comment acceptance tests
babakks Jun 10, 2026
616d929
chore(discussion/client): rename client files
babakks Jun 10, 2026
69855b7
fix(discussion comment): fix bug in requiring body/body-file in add/e…
babakks Jun 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(acceptance): use positional comment argument in discussion view …
…test

Replace --replies usage with a positional comment node ID or URL to match
the redesigned gh discussion view command.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
babakks and Copilot committed Jun 10, 2026
commit 869c044391ba73f1adca31f52d4b025430006242
24 changes: 12 additions & 12 deletions acceptance/testdata/discussion/discussion-view.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ exec gh discussion comment $DISCUSSION_URL --body 'First comment body'
exec gh discussion comment $DISCUSSION_URL --body 'Second comment body'

# Get comment IDs for reply tests
exec gh discussion view $DISCUSSION_URL --comments --order oldest --json comments
exec gh discussion view $DISCUSSION_URL --order oldest --json comments
stdout2env COMMENTS_JSON
jq2env COMMENTS_JSON '.comments.nodes[0].id' COMMENT1_ID
jq2env COMMENTS_JSON '.comments.nodes[1].id' COMMENT2_ID
Expand All @@ -55,32 +55,32 @@ exec gh discussion view $DISCUSSION_URL --comments
stdout 'First comment body'
stdout 'Second comment body'

# View with --comments in JSON mode
exec gh discussion view $DISCUSSION_URL --comments --order oldest --json number,title,comments
# View with comments in JSON mode
exec gh discussion view $DISCUSSION_URL --order oldest --json number,title,comments
stdout2env COMMENTS_JSON
jq-assert COMMENTS_JSON '.comments.nodes[0].body' 'First comment body'
jq-assert COMMENTS_JSON '.comments.nodes[1].body' 'Second comment body'

# View replies for the first comment in non-interactive mode
exec gh discussion view $DISCUSSION_URL --replies $COMMENT1_ID --order oldest
exec gh discussion view $COMMENT1_ID --order oldest
stdout 'Reply one to first'
stdout 'Reply two to first'

# View replies in JSON mode
exec gh discussion view $DISCUSSION_URL --replies $COMMENT1_ID --order oldest --json number,title,comments
exec gh discussion view $COMMENT1_ID --order oldest --json comments
stdout2env REPLIES_JSON
jq-assert REPLIES_JSON '.comments.nodes[0].replies.nodes[0].body' 'Reply one to first'
jq-assert REPLIES_JSON '.comments.nodes[0].replies.nodes[1].body' 'Reply two to first'
jq-assert REPLIES_JSON '.comments.nodes[0].replies | has("cursor")' 'false'
jq-assert REPLIES_JSON '.comments.nodes[0].replies | has("next")' 'false'

# View replies of the second comment and confirm it has none
exec gh discussion view $DISCUSSION_URL --replies $COMMENT2_ID --json number,title,comments
exec gh discussion view $COMMENT2_ID --json number,title,comments
stdout2env REPLIES2_JSON
jq-assert REPLIES2_JSON '.comments.nodes[0].replies.totalCount' '^0$'

# Pagination: limit comments to 1 and verify totalCount and next cursor
exec gh discussion view $DISCUSSION_URL --comments --order oldest --limit 1 --json comments
exec gh discussion view $DISCUSSION_URL --order oldest --limit 1 --json comments
stdout2env PAGE1_JSON
jq-assert PAGE1_JSON '.comments.totalCount' '^2$'
jq-assert PAGE1_JSON '.comments.nodes | length' '^1$'
Expand All @@ -90,15 +90,15 @@ jq-assert PAGE1_JSON '.comments.next' '.+'

# Fetch the second page of comments using the cursor
jq2env PAGE1_JSON '.comments.next' COMMENTS_CURSOR
exec gh discussion view $DISCUSSION_URL --comments --order oldest --limit 1 --after $COMMENTS_CURSOR --json comments
exec gh discussion view $DISCUSSION_URL --order oldest --limit 1 --after $COMMENTS_CURSOR --json comments
stdout2env PAGE2_JSON
jq-assert PAGE2_JSON '.comments.nodes | length' '^1$'
jq-assert PAGE2_JSON '.comments.nodes[0].body' 'Second comment body'
jq-assert PAGE2_JSON '.comments.cursor' '.+'
jq-assert PAGE2_JSON '.comments | has("next")' 'false'

# Pagination: limit replies to 1 and verify totalCount and next cursor
exec gh discussion view $DISCUSSION_URL --replies $COMMENT1_ID --order oldest --limit 1 --json comments
exec gh discussion view $COMMENT1_ID --order oldest --limit 1 --json comments
stdout2env RPAGE1_JSON
jq-assert RPAGE1_JSON '.comments.nodes[0].replies.totalCount' '^2$'
jq-assert RPAGE1_JSON '.comments.nodes[0].replies.nodes | length' '^1$'
Expand All @@ -108,16 +108,16 @@ jq-assert RPAGE1_JSON '.comments.nodes[0].replies.next' '.+'

# Fetch the second page of replies using the cursor
jq2env RPAGE1_JSON '.comments.nodes[0].replies.next' REPLIES_CURSOR
exec gh discussion view $DISCUSSION_URL --replies $COMMENT1_ID --order oldest --limit 1 --after $REPLIES_CURSOR --json comments
exec gh discussion view $COMMENT1_ID --order oldest --limit 1 --after $REPLIES_CURSOR --json comments
stdout2env RPAGE2_JSON
jq-assert RPAGE2_JSON '.comments.nodes[0].replies.nodes | length' '^1$'
jq-assert RPAGE2_JSON '.comments.nodes[0].replies.nodes[0].body' 'Reply two to first'
jq-assert RPAGE2_JSON '.comments.nodes[0].replies.cursor' '.+'
jq-assert RPAGE2_JSON '.comments.nodes[0].replies | has("next")' 'false'

# Test --replies with a comment URL instead of node ID
# Fetch replies with a comment URL instead of node ID
jq2env COMMENTS_JSON '.comments.nodes[0].url' COMMENT1_URL
exec gh discussion view $DISCUSSION_URL --replies $COMMENT1_URL --order oldest --json comments
exec gh discussion view $COMMENT1_URL --order oldest --json comments
stdout2env URL_REPLIES_JSON
jq-assert URL_REPLIES_JSON '.comments.nodes[0].replies.nodes | length' '^2$'
jq-assert URL_REPLIES_JSON '.comments.nodes[0].replies.nodes[0].body' 'Reply one to first'
Expand Down