From 84a78b05a072bf1f7428cee09372a1c2cc7f9d18 Mon Sep 17 00:00:00 2001 From: Roman Wu Date: Mon, 11 Aug 2025 17:04:48 -0400 Subject: [PATCH] feat: Add deprecation notices for AuthorAssociation field in various event types --- github/event_types.go | 47 ++++++++++++++++++++++++------- github/issues.go | 14 +++++++--- github/issues_comments.go | 4 +++ github/pulls.go | 58 +++++++++++++++++++++------------------ github/pulls_comments.go | 4 +++ github/pulls_reviews.go | 6 +++- 6 files changed, 92 insertions(+), 41 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index 6e285937fa0..480ed8dfb96 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -354,6 +354,12 @@ type DiscussionCommentEvent struct { // CommentDiscussion represents a comment in a GitHub DiscussionCommentEvent. type CommentDiscussion struct { + // AuthorAssociation is the comment author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Discussions REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/discussions/comments#get-a-discussion-comment AuthorAssociation *string `json:"author_association,omitempty"` Body *string `json:"body,omitempty"` ChildCommentCount *int `json:"child_comment_count,omitempty"` @@ -403,9 +409,15 @@ type Discussion struct { Comments *int `json:"comments,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` - AuthorAssociation *string `json:"author_association,omitempty"` - ActiveLockReason *string `json:"active_lock_reason,omitempty"` - Body *string `json:"body,omitempty"` + // AuthorAssociation is the discussion author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Discussions REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/discussions/discussions#get-a-discussion + AuthorAssociation *string `json:"author_association,omitempty"` + ActiveLockReason *string `json:"active_lock_reason,omitempty"` + Body *string `json:"body,omitempty"` } // DiscussionCategory represents a discussion category in a GitHub DiscussionEvent. @@ -1354,13 +1366,28 @@ type PullRequestTargetEvent struct { // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#push type PushEvent struct { - PushID *int64 `json:"push_id,omitempty"` - Head *string `json:"head,omitempty"` - Ref *string `json:"ref,omitempty"` - Size *int `json:"size,omitempty"` - Commits []*HeadCommit `json:"commits,omitempty"` - Before *string `json:"before,omitempty"` - DistinctSize *int `json:"distinct_size,omitempty"` + PushID *int64 `json:"push_id,omitempty"` + Head *string `json:"head,omitempty"` + Ref *string `json:"ref,omitempty"` + // Size is the number of commits in the push. + // + // Deprecated: GitHub will remove commit counts from Events API payloads on October 7, 2025. + // Use the Commits REST API endpoint to get commit information. + // See: https://docs.github.com/rest/commits/commits#list-commits + Size *int `json:"size,omitempty"` + // Commits is the list of commits in the push event. + // + // Deprecated: GitHub will remove commit summaries from Events API payloads on October 7, 2025. + // Use the Commits REST API endpoint to get detailed commit information. + // See: https://docs.github.com/rest/commits/commits#list-commits + Commits []*HeadCommit `json:"commits,omitempty"` + Before *string `json:"before,omitempty"` + // DistinctSize is the number of distinct commits in the push. + // + // Deprecated: GitHub will remove commit counts from Events API payloads on October 7, 2025. + // Use the Compare REST API endpoint to get detailed comparison information. + // See: https://docs.github.com/rest/commits/commits#compare-two-commits + DistinctSize *int `json:"distinct_size,omitempty"` // The following fields are only populated by Webhook events. Action *string `json:"action,omitempty"` diff --git a/github/issues.go b/github/issues.go index 36e3a2d7969..18bd2eff4b5 100644 --- a/github/issues.go +++ b/github/issues.go @@ -29,10 +29,16 @@ type Issue struct { Number *int `json:"number,omitempty"` State *string `json:"state,omitempty"` // StateReason can be one of: "completed", "not_planned", "reopened". - StateReason *string `json:"state_reason,omitempty"` - Locked *bool `json:"locked,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` + StateReason *string `json:"state_reason,omitempty"` + Locked *bool `json:"locked,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + // AuthorAssociation is the issue author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Issues REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/issues/issues#get-an-issue AuthorAssociation *string `json:"author_association,omitempty"` User *User `json:"user,omitempty"` Labels []*Label `json:"labels,omitempty"` diff --git a/github/issues_comments.go b/github/issues_comments.go index 2481fcbe7f3..7e0629eb312 100644 --- a/github/issues_comments.go +++ b/github/issues_comments.go @@ -22,6 +22,10 @@ type IssueComment struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` // AuthorAssociation is the comment author's relationship to the issue's repository. // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Issue Comments REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/issues/comments#get-an-issue-comment AuthorAssociation *string `json:"author_association,omitempty"` URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` diff --git a/github/pulls.go b/github/pulls.go index d5606775e1a..48717941f37 100644 --- a/github/pulls.go +++ b/github/pulls.go @@ -28,32 +28,38 @@ type PullRequestAutoMerge struct { // PullRequest represents a GitHub pull request on a repository. type PullRequest struct { - ID *int64 `json:"id,omitempty"` - Number *int `json:"number,omitempty"` - State *string `json:"state,omitempty"` - Locked *bool `json:"locked,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - ClosedAt *Timestamp `json:"closed_at,omitempty"` - MergedAt *Timestamp `json:"merged_at,omitempty"` - Labels []*Label `json:"labels,omitempty"` - User *User `json:"user,omitempty"` - Draft *bool `json:"draft,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - IssueURL *string `json:"issue_url,omitempty"` - StatusesURL *string `json:"statuses_url,omitempty"` - DiffURL *string `json:"diff_url,omitempty"` - PatchURL *string `json:"patch_url,omitempty"` - CommitsURL *string `json:"commits_url,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - ReviewCommentsURL *string `json:"review_comments_url,omitempty"` - ReviewCommentURL *string `json:"review_comment_url,omitempty"` - Assignee *User `json:"assignee,omitempty"` - Assignees []*User `json:"assignees,omitempty"` - Milestone *Milestone `json:"milestone,omitempty"` + ID *int64 `json:"id,omitempty"` + Number *int `json:"number,omitempty"` + State *string `json:"state,omitempty"` + Locked *bool `json:"locked,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + ClosedAt *Timestamp `json:"closed_at,omitempty"` + MergedAt *Timestamp `json:"merged_at,omitempty"` + Labels []*Label `json:"labels,omitempty"` + User *User `json:"user,omitempty"` + Draft *bool `json:"draft,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + IssueURL *string `json:"issue_url,omitempty"` + StatusesURL *string `json:"statuses_url,omitempty"` + DiffURL *string `json:"diff_url,omitempty"` + PatchURL *string `json:"patch_url,omitempty"` + CommitsURL *string `json:"commits_url,omitempty"` + CommentsURL *string `json:"comments_url,omitempty"` + ReviewCommentsURL *string `json:"review_comments_url,omitempty"` + ReviewCommentURL *string `json:"review_comment_url,omitempty"` + Assignee *User `json:"assignee,omitempty"` + Assignees []*User `json:"assignees,omitempty"` + Milestone *Milestone `json:"milestone,omitempty"` + // AuthorAssociation is the pull request author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Pull Requests REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/pulls/pulls#get-a-pull-request AuthorAssociation *string `json:"author_association,omitempty"` NodeID *string `json:"node_id,omitempty"` RequestedReviewers []*User `json:"requested_reviewers,omitempty"` diff --git a/github/pulls_comments.go b/github/pulls_comments.go index a9ffe8d7cc1..431b4508810 100644 --- a/github/pulls_comments.go +++ b/github/pulls_comments.go @@ -37,6 +37,10 @@ type PullRequestComment struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` // AuthorAssociation is the comment author's relationship to the pull request's repository. // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Pull Request Comments REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request AuthorAssociation *string `json:"author_association,omitempty"` URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` diff --git a/github/pulls_reviews.go b/github/pulls_reviews.go index 27b8dc37d5d..84e06a0eab7 100644 --- a/github/pulls_reviews.go +++ b/github/pulls_reviews.go @@ -24,8 +24,12 @@ type PullRequestReview struct { HTMLURL *string `json:"html_url,omitempty"` PullRequestURL *string `json:"pull_request_url,omitempty"` State *string `json:"state,omitempty"` - // AuthorAssociation is the comment author's relationship to the issue's repository. + // AuthorAssociation is the review author's relationship to the repository. // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Pull Request Reviews REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/pulls/reviews#get-a-review-for-a-pull-request AuthorAssociation *string `json:"author_association,omitempty"` }