diff --git a/github/github-accessors.go b/github/github-accessors.go index 256bfacfb5..6663fc1ae7 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -16262,6 +16262,14 @@ func (p *PullRequestLinks) GetHTMLURL() string { return *p.HTMLURL } +// GetMergedAt returns the MergedAt field if it's non-nil, zero value otherwise. +func (p *PullRequestLinks) GetMergedAt() Timestamp { + if p == nil || p.MergedAt == nil { + return Timestamp{} + } + return *p.MergedAt +} + // GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise. func (p *PullRequestLinks) GetPatchURL() string { if p == nil || p.PatchURL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 461ce8ed7e..86c9140d55 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -18864,6 +18864,16 @@ func TestPullRequestLinks_GetHTMLURL(tt *testing.T) { p.GetHTMLURL() } +func TestPullRequestLinks_GetMergedAt(tt *testing.T) { + var zeroValue Timestamp + p := &PullRequestLinks{MergedAt: &zeroValue} + p.GetMergedAt() + p = &PullRequestLinks{} + p.GetMergedAt() + p = nil + p.GetMergedAt() +} + func TestPullRequestLinks_GetPatchURL(tt *testing.T) { var zeroValue string p := &PullRequestLinks{PatchURL: &zeroValue} diff --git a/github/issues.go b/github/issues.go index 1c07fef827..a2652b3497 100644 --- a/github/issues.go +++ b/github/issues.go @@ -122,10 +122,11 @@ type IssueListOptions struct { // PullRequestLinks object is added to the Issue object when it's an issue included // in the IssueCommentEvent webhook payload, if the webhook is fired by a comment on a PR. type PullRequestLinks struct { - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - DiffURL *string `json:"diff_url,omitempty"` - PatchURL *string `json:"patch_url,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + DiffURL *string `json:"diff_url,omitempty"` + PatchURL *string `json:"patch_url,omitempty"` + MergedAt *Timestamp `json:"merged_at,omitempty"` } // List the issues for the authenticated user. If all is true, list issues diff --git a/github/issues_test.go b/github/issues_test.go index aa767d6508..d64ef88d72 100644 --- a/github/issues_test.go +++ b/github/issues_test.go @@ -499,13 +499,15 @@ func TestPullRequestLinks_Marshal(t *testing.T) { HTMLURL: String("hurl"), DiffURL: String("durl"), PatchURL: String("purl"), + MergedAt: &Timestamp{referenceTime}, } want := `{ "url": "url", "html_url": "hurl", "diff_url": "durl", - "patch_url": "purl" + "patch_url": "purl", + "merged_at": ` + referenceTimeStr + ` }` testJSONMarshal(t, u, want)