From 9b47a3695e5475b1b047aa295a0ebc22fc133d64 Mon Sep 17 00:00:00 2001 From: Jacob Foard Date: Wed, 31 Mar 2021 13:36:27 -0700 Subject: [PATCH] Add in Workflow, WorkflowRun to WorkflowRunEvent Signed-off-by: Jacob Foard --- github/event_types.go | 4 +++- github/github-accessors.go | 16 ++++++++++++++++ github/github-accessors_test.go | 14 ++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/github/event_types.go b/github/event_types.go index 72ac53de81a..928da6e3d11 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -989,7 +989,9 @@ type WorkflowDispatchEvent struct { // // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run type WorkflowRunEvent struct { - Action *string `json:"action,omitempty"` + Action *string `json:"action,omitempty"` + Workflow *Workflow `json:"workflow,omitempty"` + WorkflowRun *WorkflowRun `json:"workflow_run,omitempty"` // The following fields are only populated by Webhook events. Org *Organization `json:"organization,omitempty"` diff --git a/github/github-accessors.go b/github/github-accessors.go index d6e13c1bcfd..a37b35dacf3 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -16372,6 +16372,22 @@ func (w *WorkflowRunEvent) GetSender() *User { return w.Sender } +// GetWorkflow returns the Workflow field. +func (w *WorkflowRunEvent) GetWorkflow() *Workflow { + if w == nil { + return nil + } + return w.Workflow +} + +// GetWorkflowRun returns the WorkflowRun field. +func (w *WorkflowRunEvent) GetWorkflowRun() *WorkflowRun { + if w == nil { + return nil + } + return w.WorkflowRun +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (w *WorkflowRuns) GetTotalCount() int { if w == nil || w.TotalCount == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index bc4ff4e2a05..60e95cf5cb4 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -19224,6 +19224,20 @@ func TestWorkflowRunEvent_GetSender(tt *testing.T) { w.GetSender() } +func TestWorkflowRunEvent_GetWorkflow(tt *testing.T) { + w := &WorkflowRunEvent{} + w.GetWorkflow() + w = nil + w.GetWorkflow() +} + +func TestWorkflowRunEvent_GetWorkflowRun(tt *testing.T) { + w := &WorkflowRunEvent{} + w.GetWorkflowRun() + w = nil + w.GetWorkflowRun() +} + func TestWorkflowRuns_GetTotalCount(tt *testing.T) { var zeroValue int w := &WorkflowRuns{TotalCount: &zeroValue}