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 }] }` diff --git a/github/github-accessors.go b/github/github-accessors.go index 0d9db6ff896..2cc8ce0d561 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -20606,6 +20606,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 bd2b95dea8b..c0565725961 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -24063,6 +24063,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}