Skip to content

Unable to provide stateReason to --json flag of issue view #8782

Description

@andyatmiami

Describe the bug

The state_reason issue attribute cannot be provided to the --json parameter of the issue view command.

The state_reason Issue attribute is referenced in numerous files (not complete list):

It was also discussed in this Issue:

All discussion makes it appear that stateReason is a supported field. However, it is not defined in the Available fields listed when providing an invalid --json value.

Steps to reproduce the behavior

  1. $ gh issue view -R owner/repo/73 --json closed,closedAt,state,stateReason
  2. View the output:
    Unknown JSON field: "stateReason"
    Available fields:
      assignees
      author
      body
      closed
      closedAt
      comments
      createdAt
      id
      labels
      milestone
      number
      projectCards
      projectItems
      reactionGroups
      state
      title
      updatedAt
      url
    
  3. See error

Expected vs actual behavior

Expected: state_reason Issue field should able to be returned by specifying stateReason within the --json flag
Actual: error stating stateReason is not an available field.

Logs

$ gh version
gh version 2.44.1 (2024-02-16)

Activity

  1. andyatmiami commented on Mar 2, 2024

    @andyatmiami
    Author

    I realize the state_reason can be retrieved via gh api as such:

    • gh api repos/{owner}/{repo}/issues/73

    But I would claim the state_reason field is an vital piece of information in understanding the state.

    If state is an available field, I feel its essential for the same reasoning that state_reason be supported.

  2. changed the title [-]Unable to provision stateReason to --json flag of issue view[/-] [+]Unable to provide stateReason to --json flag of issue view[/+] on Mar 2, 2024
  3. added
    gh-issuerelating to the gh issue command
    and removed on Apr 30, 2024
  4. mxie commented on Apr 30, 2024

    @mxie
    Member

    Thanks @andyatmiami! This seems like a reasonable ask, and I appreciate that you found it's available via gh api at least. 👍 Marking this with help wanted to open this work up to you or other folks to to add support!

  5. added
    enhancementa request to improve CLI
    and removed
    bugSomething isn't working
    on Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-issuerelating to the gh issue commandhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions