Skip to content

Fix project item-add output for non-TTY - #14056

Merged
babakks merged 4 commits into
cli:trunkfrom
zwick:zwick-fix-project-item-add-output
Aug 10, 2026
Merged

Fix project item-add output for non-TTY#14056
babakks merged 4 commits into
cli:trunkfrom
zwick:zwick-fix-project-item-add-output

Conversation

@zwick

@zwick zwick commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #14055

Description

gh project item-add emitted no output when stdout was not a TTY. It now prints the created ProjectV2 item ID, while preserving Added item for TTY output and existing --format output.

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-add

Key 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:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @zwick will read and reply directly.
  • An agent will draft replies and @username will read them before they are posted.
  • Nobody has explicitly committed to replying.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added external pull request originating outside of the CLI core team needs-triage needs to be reviewed labels Aug 3, 2026
@zwick
zwick marked this pull request as ready for review August 3, 2026 18:52
@zwick
zwick requested a review from a team as a code owner August 3, 2026 18:52
@zwick
zwick requested review from Copilot and tidy-dev and removed request for Copilot August 3, 2026 18:52
@github-actions github-actions Bot added unmet-requirements and removed needs-triage needs to be reviewed labels Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for your pull request! Unfortunately, it doesn't meet the requirements for review:

  • None of the referenced issues have the help wanted label

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
  1. Include a detailed description of what this PR does
  2. Link to an issue with the help wanted label (use Fixes #123 or Closes #123)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 printResults to print Added item on TTY stdout and print the created ProjectV2 item ID on non-TTY stdout.
  • Preserved existing --format behavior by continuing to bypass printResults when an exporter is configured.
  • Added focused regression coverage for printResults across 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

Comment thread pkg/cmd/project/item-add/item_add.go

@williammartin williammartin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Comment thread pkg/cmd/project/item-add/item_add_test.go Outdated
zwick and others added 3 commits August 7, 2026 15:55
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>
@babakks

babakks commented Aug 10, 2026

Copy link
Copy Markdown
Member

Dismissing @williammartin's review as the requested changes are applied.

@babakks
babakks dismissed williammartin’s stale review August 10, 2026 09:06

The requested changes are applied.

@babakks
babakks merged commit 78de863 into cli:trunk Aug 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh project item-add suppresses success output when stdout is not a TTY

4 participants