Skip to content

Add issue field support to gh CLI - #13948

Draft
ayy-bc wants to merge 2 commits into
cli:trunkfrom
ayy-bc:issue-fields
Draft

Add issue field support to gh CLI#13948
ayy-bc wants to merge 2 commits into
cli:trunkfrom
ayy-bc:issue-fields

Conversation

@ayy-bc

@ayy-bc ayy-bc commented Jul 23, 2026

Copy link
Copy Markdown

Adds support for Projects v2 issue fields.

Issue field values live on the issue itself, like labels and assignees. So the split is:

  • Reading works from the project. Values show up in gh project item-list --format json.
  • Writing has its own issue scoped command: gh issue edit-field <issue> --field-id <id> with one of --text, --number, --date, --single-select-option-id, --multi-select-option-ids, or --clear.
  • gh project field-create --issue-field-id <id> attaches an existing org or repo issue field to a project as a column.

gh project item-edit is unchanged, since issue field values are not set on the project item.

The GraphQL input structs are defined locally because the vendored githubv4 does not have the issue field types yet.

Draft for now. Holding until issue fields are GA in the public schema.

…field

Issue field values live on the issue itself (like labels and assignees), so:
- Read: ProjectV2ItemIssueFieldValue is surfaced through the project item field
  values and exported by gh project item-list --format json.
- Write: new issue-scoped command 'gh issue edit-field <issue> --field-id ...'
  sets/clears a typed value via updateIssueFieldValue, keeping gh project
  item-edit for project-item field writes.
- Attach: gh project field-create --issue-field-id surfaces an existing org/repo
  issue field on a project as a column (createProjectV2IssueField).

Local input structs supply the issue-field GraphQL types the vendored githubv4
lacks.
@github-actions github-actions Bot added external pull request originating outside of the CLI core team needs-triage needs to be reviewed labels Jul 23, 2026
Clear bool
}

// UpdateIssueFieldValueInput is defined locally because the vendored githubv4 lacks the issue-field types.

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.

Same comment as I left on your other PR. We should consider opening a PR against the package we are vendoring to support these field types so we don't have mis-alignment between field types supported in different tooling and to avoid creating a maintenance layer here

$ gh issue create --parent 100
$ gh issue create --parent https://github.com/cli/go-gh/issues/42
$ gh issue create --blocked-by 200,201 --blocking 300
$ gh issue create --field "Team" --value "Platform"

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.

Can I create an issue with multiple Issue Field Values? Or can I only create it with a single Field populated then I need to update the Issue after creation?

@BagToad BagToad Jul 23, 2026

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.

These flags could be registered as stringarrayvar types, allowing the flags to be repeated:

gh issue create --field "Team" --value "Platform" --field "Priority" --value "High"

We'd loop through the arrays and pair up fields with values, in order.

The problem with this design is that ordering matters, but it might be ok.

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.

The other alternative is something like --field="name-goes-here=value-goes-here"

Comment on lines +78 to +85
# Set a single-select issue field value by option ID
$ gh issue edit-field 23 --field-id <field-id> --single-select-option-id <option-id>

# Set a multi-select issue field value by option IDs
$ gh issue edit-field 23 --field-id <field-id> --multi-select-option-ids <id1>,<id2>

# Clear an issue field value
$ gh issue edit-field 23 --field-id <field-id> --clear

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.

nit: I commented on this PR as well - the ergonomics of this CLI contract feels a bit clunky to me. Needing to know the data type of the Field I am passing and specifying different flags for multi-select vs single-select is a bit awkward as a user

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 needs-triage needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants