Skip to content

Commit 6b805b3

Browse files
authored
feat: Add issue field values support for write and read (#4200)
1 parent 144172e commit 6b805b3

3 files changed

Lines changed: 236 additions & 28 deletions

File tree

github/github-accessors.go

Lines changed: 80 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 104 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/issues.go

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,31 @@ type Issue struct {
3939
// Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025.
4040
// Use the Issues REST API endpoint to retrieve this information.
4141
// See: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue
42-
AuthorAssociation *string `json:"author_association,omitempty"`
43-
User *User `json:"user,omitempty"`
44-
Labels []*Label `json:"labels,omitempty"`
45-
Assignee *User `json:"assignee,omitempty"`
46-
Comments *int `json:"comments,omitempty"`
47-
ClosedAt *Timestamp `json:"closed_at,omitempty"`
48-
CreatedAt *Timestamp `json:"created_at,omitempty"`
49-
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
50-
ClosedBy *User `json:"closed_by,omitempty"`
51-
URL *string `json:"url,omitempty"`
52-
HTMLURL *string `json:"html_url,omitempty"`
53-
CommentsURL *string `json:"comments_url,omitempty"`
54-
EventsURL *string `json:"events_url,omitempty"`
55-
LabelsURL *string `json:"labels_url,omitempty"`
56-
RepositoryURL *string `json:"repository_url,omitempty"`
57-
ParentIssueURL *string `json:"parent_issue_url,omitempty"`
58-
Milestone *Milestone `json:"milestone,omitempty"`
59-
PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"`
60-
Repository *Repository `json:"repository,omitempty"`
61-
Reactions *Reactions `json:"reactions,omitempty"`
62-
Assignees []*User `json:"assignees,omitempty"`
63-
NodeID *string `json:"node_id,omitempty"`
64-
Draft *bool `json:"draft,omitempty"`
65-
Type *IssueType `json:"type,omitempty"`
42+
AuthorAssociation *string `json:"author_association,omitempty"`
43+
User *User `json:"user,omitempty"`
44+
Labels []*Label `json:"labels,omitempty"`
45+
Assignee *User `json:"assignee,omitempty"`
46+
Comments *int `json:"comments,omitempty"`
47+
ClosedAt *Timestamp `json:"closed_at,omitempty"`
48+
CreatedAt *Timestamp `json:"created_at,omitempty"`
49+
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
50+
ClosedBy *User `json:"closed_by,omitempty"`
51+
URL *string `json:"url,omitempty"`
52+
HTMLURL *string `json:"html_url,omitempty"`
53+
CommentsURL *string `json:"comments_url,omitempty"`
54+
EventsURL *string `json:"events_url,omitempty"`
55+
LabelsURL *string `json:"labels_url,omitempty"`
56+
RepositoryURL *string `json:"repository_url,omitempty"`
57+
ParentIssueURL *string `json:"parent_issue_url,omitempty"`
58+
Milestone *Milestone `json:"milestone,omitempty"`
59+
PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"`
60+
Repository *Repository `json:"repository,omitempty"`
61+
Reactions *Reactions `json:"reactions,omitempty"`
62+
Assignees []*User `json:"assignees,omitempty"`
63+
NodeID *string `json:"node_id,omitempty"`
64+
Draft *bool `json:"draft,omitempty"`
65+
Type *IssueType `json:"type,omitempty"`
66+
IssueFieldValues []*IssueFieldValue `json:"issue_field_values,omitempty"`
6667

6768
// TextMatches is only populated from search results that request text matches
6869
// See: search.go and https://docs.github.com/rest/search/#text-match-metadata
@@ -94,10 +95,11 @@ type IssueRequest struct {
9495
Assignee *string `json:"assignee,omitempty"`
9596
State *string `json:"state,omitempty"`
9697
// StateReason can be 'completed' or 'not_planned'.
97-
StateReason *string `json:"state_reason,omitempty"`
98-
Milestone *int `json:"milestone,omitempty"`
99-
Assignees *[]string `json:"assignees,omitempty"`
100-
Type *string `json:"type,omitempty"`
98+
StateReason *string `json:"state_reason,omitempty"`
99+
Milestone *int `json:"milestone,omitempty"`
100+
Assignees *[]string `json:"assignees,omitempty"`
101+
Type *string `json:"type,omitempty"`
102+
IssueFieldValues []*IssueFieldValue `json:"issue_field_values,omitempty"`
101103
}
102104

103105
// PullRequestLinks object is added to the Issue object when it's an issue included
@@ -122,6 +124,28 @@ type IssueType struct {
122124
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
123125
}
124126

127+
// IssueFieldValueSingleSelectOption represents a single-select option for an issue field value.
128+
//
129+
// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue
130+
type IssueFieldValueSingleSelectOption struct {
131+
ID *int64 `json:"id,omitempty"`
132+
Name *string `json:"name,omitempty"`
133+
Color *string `json:"color,omitempty"`
134+
}
135+
136+
// IssueFieldValue represents a custom field value attached to an issue.
137+
// The Value field contains a string for text, single_select, and date fields,
138+
// or a number for numeric fields.
139+
//
140+
// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue
141+
type IssueFieldValue struct {
142+
IssueFieldID *int64 `json:"issue_field_id,omitempty"`
143+
NodeID *string `json:"node_id,omitempty"`
144+
DataType *string `json:"data_type,omitempty"`
145+
Value any `json:"value,omitempty"`
146+
SingleSelectOption *IssueFieldValueSingleSelectOption `json:"single_select_option,omitempty"`
147+
}
148+
125149
// ListAllIssuesOptions specifies the optional parameters to the
126150
// IssuesService.ListAllIssues method.
127151
type ListAllIssuesOptions struct {

0 commit comments

Comments
 (0)