feat: add gh discussion create command#13359
Merged
Merged
Conversation
Implements the 'gh discussion create' CLI command, wiring up the already-merged Create client method. Supports: - --title/-t, --body/-b, --category/-c, --label/-l flags - Interactive prompting when TTY and required flags are missing - Non-TTY mode requiring all flags - TTY and non-TTY output formats Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Thanks for your pull request! Unfortunately, it doesn't meet the requirements for review:
Please update your PR to address the above. This PR will be automatically closed in 4 days if these requirements are not met. Full contribution requirements
|
- Resolve labels before creating discussion so a bad label name doesn't leave an orphaned discussion (atomicity fix) - Validate --title/--category/--body non-interactively before calling ListCategories to avoid an unnecessary network round-trip - Set blankAllowed=false so the markdown editor rejects empty bodies - Clarify help text: --body is required when not running interactively - Update tests to match new behavior; rename label-not-found test to make the atomicity guarantee explicit Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Move non-interactive flag validation to arg parsing stage - Add blank title/body/category validation at flag parsing - Keep interactive blank-title/body checks after prompts - Always print URL to stdout; success message to stderr in TTY mode - Consolidate test cases and add isTTY field Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Only print the discussion URL to stdout. No additional output on stderr. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Merge TestCreateRun_nonInteractive, TestCreateRun_tty, and related tests into a single TestCreateRun table with 11 cases - Add partial-flag cases for missing title, body, and category - Add tty blank body returns error case - Add tty does not prompt when all flags provided case Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Member
|
Thanks for the PR, @maxbeizer! It's amazing! 🙏 I made some changes (expand below) and tested it end-to-end. I'll merge it once the CI is finished. Let me know if you have any comments so that I can fix in a follow up. Next stop is implementing the API client methods for ChangesDetails
Pushed a round of polish on top:
ExperienceHere are some screenshots for later reference. Non-interactiveInteractive (category selection)
Interactive
|
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.


Implements the
gh discussion createCLI command, wiring up the Create client method from #13316.Changes
pkg/cmd/discussion/create/package withcreate.goandcreate_test.godiscussion.gounder the "General commands" group--title/-t,--body/-b,--category/-c,--label/-lPart of stacked PRs
This is part of the
gh discussioncommand series targetingfeature/discussion.