Repository: google/go-github (Go)

Issue:
`reason` is missing in the `PullRequestEvent` for `dequeue` action
Current Types: https://github.com/google/go-github/blob/1b5327022dae033d6f71bba45867529a80c8fc10/github/event_types.go#L1215-L1252

Github Events Doc: https://docs.github.com/en/rest/using-the-rest-api/github-event-types?apiVersion=2022-11-28#event-payload-object-for-pullrequestevent
> reason | string | The reason the pull request was removed from a merge queue if the action was dequeued.

Webhook doc: https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=dequeued#pull_request:~:text=reason%20string%20Required,GIT_TREE_INVALID%2C%20INVALID_MERGE_COMMIT




Discussion:

Patch:
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/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 {


Test patch:
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_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{}