diff --git a/github/event_types.go b/github/event_types.go index 480ed8dfb96..80b0cf0485b 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1237,7 +1237,8 @@ type PullRequestEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` - Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries. + Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries. + Reason *string `json:"reason,omitempty"` // Populated in "dequeued" event deliveries. // The following field is only present when the webhook is triggered on // a repository belonging to an organization. diff --git a/github/event_types_test.go b/github/event_types_test.go index 6bc9f799e4e..9ad223dca69 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -16079,6 +16079,7 @@ func TestPullRequestEvent_Marshal(t *testing.T) { }, RequestedTeam: &Team{ID: Ptr(int64(1))}, Label: &Label{ID: Ptr(int64(1))}, + Reason: Ptr("CI_FAILURE"), Before: Ptr("before"), After: Ptr("after"), Repo: &Repository{ @@ -16268,6 +16269,7 @@ func TestPullRequestEvent_Marshal(t *testing.T) { "label": { "id": 1 }, + "reason": "CI_FAILURE", "before": "before", "after": "after", "repository": { diff --git a/github/github-accessors.go b/github/github-accessors.go index b470ba80255..6f03afa99ba 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -19918,6 +19918,14 @@ func (p *PullRequestEvent) GetPullRequest() *PullRequest { return p.PullRequest } +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (p *PullRequestEvent) GetReason() string { + if p == nil || p.Reason == nil { + return "" + } + return *p.Reason +} + // GetRepo returns the Repo field. func (p *PullRequestEvent) GetRepo() *Repository { if p == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index d61b00e5f69..59282ed1f07 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -25751,6 +25751,17 @@ func TestPullRequestEvent_GetPullRequest(tt *testing.T) { p.GetPullRequest() } +func TestPullRequestEvent_GetReason(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PullRequestEvent{Reason: &zeroValue} + p.GetReason() + p = &PullRequestEvent{} + p.GetReason() + p = nil + p.GetReason() +} + func TestPullRequestEvent_GetRepo(tt *testing.T) { tt.Parallel() p := &PullRequestEvent{}