Skip to content

Add multi-select field support to gh project - #13947

Draft
ayy-bc wants to merge 1 commit into
cli:trunkfrom
ayy-bc:multi-select-fields
Draft

Add multi-select field support to gh project#13947
ayy-bc wants to merge 1 commit into
cli:trunkfrom
ayy-bc:multi-select-fields

Conversation

@ayy-bc

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

Copy link
Copy Markdown

Adds support for Projects v2 multi-select fields to the project commands.

What's included:

  • Read and JSON export of multi-select values in gh project item-list --format json
  • Set values with gh project item-edit, either by option IDs with --multi-select-option-ids or by name with a comma-separated --value
  • Create a multi-select field with gh project field-create --data-type MULTI_SELECT --multi-select-options "a,b,c"
  • Name based option resolution, the same way single-select works

The GraphQL input structs are defined locally because the vendored githubv4 does not have the multi-select types yet.

Draft for now. Multi-select is not in the public GraphQL schema yet, so I am holding this until it goes GA.

Adds read + write for ProjectV2 multi-select fields:
- queries.go: ProjectV2MultiSelectField in the ProjectField union and
  ProjectV2ItemFieldMultiSelectValue in the item field-value union, with
  JSON export.
- ResolveMultiSelectOptionIDs for name-based option resolution.
- item-edit: --multi-select-option-ids and comma-separated --value.
- field-create: MULTI_SELECT data type with --multi-select-options.

Local input structs supply multiSelectOptionIds / multiSelectOptions since
the vendored githubv4 lacks them.
@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
} `graphql:"clearProjectV2ItemFieldValue(input:$input)"`
}

// ProjectV2FieldValue is defined locally because the vendored githubv4 lacks multiSelectOptionIds.

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.

Perhaps we could open a PR against the githubv4 package to fill this gap? This seems fine as an interim solution but we wouldn't want to maintain our own mapping that isn't available in the underlying package to keep surface areas consistent

editItemCmd.Flags().Float64Var(&opts.number, "number", 0, "Number value for the field")
editItemCmd.Flags().StringVar(&opts.date, "date", "", "Date value for the field (YYYY-MM-DD)")
editItemCmd.Flags().StringVar(&opts.singleSelectOptionID, "single-select-option-id", "", "ID of the single select option value to set on the field")
editItemCmd.Flags().StringSliceVar(&opts.multiSelectOptionIDs, "multi-select-option-ids", nil, "IDs of the multi select option values to set on the field")

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: passing thought, not sure if this PR is the appropriate place to address this feedback

Single Select vs Multi-Select are very similar, essentially enforcing a different number of Max Selected Options. As a user, the ergonomics would feel nicer if this was a single uniform flag instead of two different flags for the different data types

// splitOptionNames splits a comma-separated --value into individual option names
// for multi-select fields, trimming surrounding spaces and dropping empties.
func splitOptionNames(value string) []string {
parts := strings.Split(value, ",")

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.

Just to confirm: is a Comma disallowed from being included in an Option Name for multi-select values?

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.

2 participants