From 88abac8701e3f7e077a53f38173fd5795116e6b6 Mon Sep 17 00:00:00 2001 From: JoannaaKL Date: Tue, 7 May 2024 11:47:44 +0000 Subject: [PATCH] Add Action to DeploymentStatusEvent --- github/event_types.go | 1 + github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ 3 files changed, 19 insertions(+) diff --git a/github/event_types.go b/github/event_types.go index 703af1f2f2b..e5ae33a5fa0 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -232,6 +232,7 @@ type DeploymentProtectionRuleEvent struct { // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#deployment_status type DeploymentStatusEvent struct { + Action *string `json:"action,omitempty"` Deployment *Deployment `json:"deployment,omitempty"` DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"` Repo *Repository `json:"repository,omitempty"` diff --git a/github/github-accessors.go b/github/github-accessors.go index 3ba66c80d47..fd2fe22591d 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -5878,6 +5878,14 @@ func (d *DeploymentStatus) GetURL() string { return *d.URL } +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (d *DeploymentStatusEvent) GetAction() string { + if d == nil || d.Action == nil { + return "" + } + return *d.Action +} + // GetDeployment returns the Deployment field. func (d *DeploymentStatusEvent) GetDeployment() *Deployment { if d == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 5b0e1de66dc..294822bf3aa 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -6886,6 +6886,16 @@ func TestDeploymentStatus_GetURL(tt *testing.T) { d.GetURL() } +func TestDeploymentStatusEvent_GetAction(tt *testing.T) { + var zeroValue string + d := &DeploymentStatusEvent{Action: &zeroValue} + d.GetAction() + d = &DeploymentStatusEvent{} + d.GetAction() + d = nil + d.GetAction() +} + func TestDeploymentStatusEvent_GetDeployment(tt *testing.T) { d := &DeploymentStatusEvent{} d.GetDeployment()