From e177f1dd856201df197e9d53a64ff257678b3d4b Mon Sep 17 00:00:00 2001 From: Pavel Dvoinos Date: Wed, 9 Nov 2022 16:28:28 +0200 Subject: [PATCH 1/2] added RunAttempt field for --- github/actions_workflow_jobs.go | 1 + github/actions_workflow_jobs_test.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/github/actions_workflow_jobs.go b/github/actions_workflow_jobs.go index 2867e82af07..1422fd471c9 100644 --- a/github/actions_workflow_jobs.go +++ b/github/actions_workflow_jobs.go @@ -44,6 +44,7 @@ type WorkflowJob struct { RunnerName *string `json:"runner_name,omitempty"` RunnerGroupID *int64 `json:"runner_group_id,omitempty"` RunnerGroupName *string `json:"runner_group_name,omitempty"` + RunAttempt *int64 `json:"run_attempt,omitempty"` } // Jobs represents a slice of repository action workflow job. diff --git a/github/actions_workflow_jobs_test.go b/github/actions_workflow_jobs_test.go index 49315a03ba4..204f0014092 100644 --- a/github/actions_workflow_jobs_test.go +++ b/github/actions_workflow_jobs_test.go @@ -324,6 +324,7 @@ func TestJobs_Marshal(t *testing.T) { }, }, CheckRunURL: String("c"), + RunAttempt: Int64(2), }, }, } @@ -351,7 +352,8 @@ func TestJobs_Marshal(t *testing.T) { "started_at": ` + referenceTimeStr + `, "completed_at": ` + referenceTimeStr + ` }], - "check_run_url": "c" + "check_run_url": "c", + "run_attempt": 2 }] }` From e0d5568d9a36adadbbd3b9d8293590fc2c892e07 Mon Sep 17 00:00:00 2001 From: Pavel Dvoinos Date: Wed, 9 Nov 2022 17:51:24 +0200 Subject: [PATCH 2/2] add generated accessor + test --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index de2e0daee16..8e80c7e972e 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -20566,6 +20566,14 @@ func (w *WorkflowJob) GetNodeID() string { return *w.NodeID } +// GetRunAttempt returns the RunAttempt field if it's non-nil, zero value otherwise. +func (w *WorkflowJob) GetRunAttempt() int64 { + if w == nil || w.RunAttempt == nil { + return 0 + } + return *w.RunAttempt +} + // GetRunID returns the RunID field if it's non-nil, zero value otherwise. func (w *WorkflowJob) GetRunID() int64 { if w == nil || w.RunID == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index c967119b3d6..c2d8c9627cd 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -24013,6 +24013,16 @@ func TestWorkflowJob_GetNodeID(tt *testing.T) { w.GetNodeID() } +func TestWorkflowJob_GetRunAttempt(tt *testing.T) { + var zeroValue int64 + w := &WorkflowJob{RunAttempt: &zeroValue} + w.GetRunAttempt() + w = &WorkflowJob{} + w.GetRunAttempt() + w = nil + w.GetRunAttempt() +} + func TestWorkflowJob_GetRunID(tt *testing.T) { var zeroValue int64 w := &WorkflowJob{RunID: &zeroValue}