Fix project item-add output for non-TTY - #14056
Conversation
Co-authored-by: Copilot App <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
|
There was a problem hiding this comment.
Pull request overview
This pull request fixes a regression in gh project item-add where successful runs produced no output when stdout was not a TTY (e.g., in scripts). It updates the default (non---format) output behavior to always emit a success signal while preserving existing interactive (TTY) messaging and structured --format output.
Changes:
- Updated
printResultsto printAdded itemon TTY stdout and print the created ProjectV2 item ID on non-TTY stdout. - Preserved existing
--formatbehavior by continuing to bypassprintResultswhen an exporter is configured. - Added focused regression coverage for
printResultsacross TTY and non-TTY stdout.
Show a summary per file
| File | Description |
|---|---|
| pkg/cmd/project/item-add/item_add.go | Adjusts success output selection so non-TTY runs emit the created item ID while TTY runs keep the human-friendly confirmation. |
| pkg/cmd/project/item-add/item_add_test.go | Adds a table-driven test to cover printResults output for both TTY and non-TTY stdout. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
williammartin
left a comment
There was a problem hiding this comment.
Just one change really, and I'm gonna be out on vacation Monday for 2 weeks so you'll have to chase someone else sorry!
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Dismissing @williammartin's review as the requested changes are applied. |
The requested changes are applied.
Fixes #14055
Description
gh project item-addemitted no output when stdout was not a TTY. It now prints the created ProjectV2 item ID, while preservingAdded itemfor TTY output and existing--formatoutput.How did you test this change?
go test ./pkg/cmd/project/item-add -run 'Test(PrintResults|RunAddItem_JSON)$'Result:
ok github.com/cli/cli/v2/pkg/cmd/project/item-addKey points
The existing mutation result supplies the item ID, so this adds no API requests.
Notes for reviewers
The change is limited to output selection and focused regression coverage.
Authorship and follow-up
Who wrote this:
Who answers review comments: