{{ message }}
Add issueFieldValues to gh issue view --json fields#13707
Draft
owenniblock wants to merge 1 commit into
Draft
Conversation
GitHub now supports native repository-level issue fields (e.g. Priority,
Estimate) — distinct from ProjectV2 custom fields. These live under the
`issueFieldValues` connection on the `Issue` GraphQL type, but
`gh issue view --json` had no way to surface them.
This adds `issueFieldValues` as a supported JSON field on
`gh issue view` (and inherits to `gh issue list`, `gh issue status`).
Each value carries its `__typename`, the parent `field` (name +
dataType), and the type-specific payload:
- IssueFieldSingleSelectValue: name, optionId, color
- IssueFieldTextValue: text
- IssueFieldNumberValue: number
- IssueFieldDateValue: date
Example:
gh issue view 29 --repo github/local-agent-loop --json issueFieldValues
{"issueFieldValues":[{"__typename":"IssueFieldSingleSelectValue",
"color":"BLUE","field":{"dataType":"SINGLE_SELECT",
"name":"Priority"},"name":"P2",
"optionId":"IFSSO_kgAC"}]}
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fa4c55b to
86a3e7f
Compare
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.

Summary
Adds support for the new native repository-level issue fields (e.g. Priority, Estimate) to the JSON output of
gh issue view,gh issue list, andgh issue status.These fields live under the
issueFieldValuesconnection on theIssueGraphQL type and are distinct from ProjectV2 custom fields — they're set directly on the issue without a project. Today the CLI has no way to surface them:--json issueFieldValueserrors out as unsupported.Motivation
I hit this while reading a Priority value off an issue. The Priority sidebar widget is clearly populated, but there was no CLI-friendly way to read it. The only workaround was hand-rolling a GraphQL query via
gh api graphql. After confirming no existing PR or issue mentionedissueFieldValuesin cli/cli, I put this together.Changes
api/queries_issue.go: newIssueFieldValues/IssueFieldValuetypes covering the four union variants (SingleSelect,Text,Number,Date)api/query_builder.go: registerissueFieldValuesinissueOnlyFieldsand emit the GraphQL fragment with inline...onselections for each variantapi/export_pr.go: flatten union members into a clean JSON shape per typenameapi/export_pr_test.go: unit test for the single-select case (the most common one — Priority/Status/etc.)pkg/cmd/issue/view/view_test.go: add to the supported-fields expectationOutput shape
Each entry carries
__typename, the parentfield(name+dataType), and the type-specific payload:{ "issueFieldValues": [ { "__typename": "IssueFieldSingleSelectValue", "color": "BLUE", "field": { "dataType": "SINGLE_SELECT", "name": "Priority" }, "name": "P2", "optionId": "IFSSO_kgAC" } ] }Verified end-to-end against a real issue:
Notes / open questions
gh issue view --helpexamples.valuekey, mirroring theprojectItemsprecedent. Happy to switch if a nested shape is preferred.gh issue viewoutput too.go test ./api/... ./pkg/cmd/issue/...passes.