Skip to content

gh pr comment with body from STDIN #12136

Description

@zaufi

Describe the bug

The command echo foo | DEBUG=api gh pr comment "$pr_id" --body - adds the comment with - symbol only.

Affected version

Please run gh version and paste the output below:

$ gh --version
gh version 2.83.0 (2025-11-11)
https://github.com/cli/cli/releases/tag/v2.83.0

Steps to reproduce the behavior

  1. Type this echo foo | DEBUG=api gh pr comment <PR-NUMBER> --body -
  2. Check the comment in PR.

Expected vs actual behavior

A comment with text foo added to a PR.

Logs

Paste the activity from your command line. Redact if needed.

GraphQL query:
mutation CommentCreate($input:AddCommentInput!){addComment(input: $input){commentEdge{node{url}}}}
GraphQL variables: {"input":{"subjectId":"PR_kwDOBSdkQM6ypkfz","body":"-"}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions