From c0154b5fe16a511d4f164f77970d2481b249e2f6 Mon Sep 17 00:00:00 2001 From: Dustin Lish Date: Thu, 23 Feb 2023 13:18:08 -0700 Subject: [PATCH] Add created_at to WorkflowJob struct --- github/actions_workflow_jobs.go | 1 + github/actions_workflow_jobs_test.go | 4 ++++ github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ 4 files changed, 23 insertions(+) diff --git a/github/actions_workflow_jobs.go b/github/actions_workflow_jobs.go index b55f9aa7f8..b7130916fe 100644 --- a/github/actions_workflow_jobs.go +++ b/github/actions_workflow_jobs.go @@ -33,6 +33,7 @@ type WorkflowJob struct { HTMLURL *string `json:"html_url,omitempty"` Status *string `json:"status,omitempty"` Conclusion *string `json:"conclusion,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` StartedAt *Timestamp `json:"started_at,omitempty"` CompletedAt *Timestamp `json:"completed_at,omitempty"` Name *string `json:"name,omitempty"` diff --git a/github/actions_workflow_jobs_test.go b/github/actions_workflow_jobs_test.go index da52619a19..521e401102 100644 --- a/github/actions_workflow_jobs_test.go +++ b/github/actions_workflow_jobs_test.go @@ -251,6 +251,7 @@ func TestWorkflowJob_Marshal(t *testing.T) { HTMLURL: String("h"), Status: String("s"), Conclusion: String("c"), + CreatedAt: &Timestamp{referenceTime}, StartedAt: &Timestamp{referenceTime}, CompletedAt: &Timestamp{referenceTime}, Name: String("n"), @@ -278,6 +279,7 @@ func TestWorkflowJob_Marshal(t *testing.T) { "html_url": "h", "status": "s", "conclusion": "c", + "created_at": ` + referenceTimeStr + `, "started_at": ` + referenceTimeStr + `, "completed_at": ` + referenceTimeStr + `, "name": "n", @@ -312,6 +314,7 @@ func TestJobs_Marshal(t *testing.T) { HTMLURL: String("h"), Status: String("s"), Conclusion: String("c"), + CreatedAt: &Timestamp{referenceTime}, StartedAt: &Timestamp{referenceTime}, CompletedAt: &Timestamp{referenceTime}, Name: String("n"), @@ -344,6 +347,7 @@ func TestJobs_Marshal(t *testing.T) { "html_url": "h", "status": "s", "conclusion": "c", + "created_at": ` + referenceTimeStr + `, "started_at": ` + referenceTimeStr + `, "completed_at": ` + referenceTimeStr + `, "name": "n", diff --git a/github/github-accessors.go b/github/github-accessors.go index 59a59a4edb..a7d800e20a 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -21006,6 +21006,14 @@ func (w *WorkflowJob) GetConclusion() string { return *w.Conclusion } +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (w *WorkflowJob) GetCreatedAt() Timestamp { + if w == nil || w.CreatedAt == nil { + return Timestamp{} + } + return *w.CreatedAt +} + // GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. func (w *WorkflowJob) GetHeadSHA() string { if w == nil || w.HeadSHA == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 7239698a30..2bd40a94be 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -24548,6 +24548,16 @@ func TestWorkflowJob_GetConclusion(tt *testing.T) { w.GetConclusion() } +func TestWorkflowJob_GetCreatedAt(tt *testing.T) { + var zeroValue Timestamp + w := &WorkflowJob{CreatedAt: &zeroValue} + w.GetCreatedAt() + w = &WorkflowJob{} + w.GetCreatedAt() + w = nil + w.GetCreatedAt() +} + func TestWorkflowJob_GetHeadSHA(tt *testing.T) { var zeroValue string w := &WorkflowJob{HeadSHA: &zeroValue}