diff --git a/github/actions_workflow_runs.go b/github/actions_workflow_runs.go index 2c90956c268..1e1ff61ae8f 100644 --- a/github/actions_workflow_runs.go +++ b/github/actions_workflow_runs.go @@ -14,33 +14,36 @@ import ( // WorkflowRun represents a repository action workflow run. type WorkflowRun struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - NodeID *string `json:"node_id,omitempty"` - HeadBranch *string `json:"head_branch,omitempty"` - HeadSHA *string `json:"head_sha,omitempty"` - RunNumber *int `json:"run_number,omitempty"` - Event *string `json:"event,omitempty"` - Status *string `json:"status,omitempty"` - Conclusion *string `json:"conclusion,omitempty"` - WorkflowID *int64 `json:"workflow_id,omitempty"` - CheckSuiteID *int64 `json:"check_suite_id,omitempty"` - CheckSuiteNodeID *string `json:"check_suite_node_id,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - PullRequests []*PullRequest `json:"pull_requests,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - JobsURL *string `json:"jobs_url,omitempty"` - LogsURL *string `json:"logs_url,omitempty"` - CheckSuiteURL *string `json:"check_suite_url,omitempty"` - ArtifactsURL *string `json:"artifacts_url,omitempty"` - CancelURL *string `json:"cancel_url,omitempty"` - RerunURL *string `json:"rerun_url,omitempty"` - HeadCommit *HeadCommit `json:"head_commit,omitempty"` - WorkflowURL *string `json:"workflow_url,omitempty"` - Repository *Repository `json:"repository,omitempty"` - HeadRepository *Repository `json:"head_repository,omitempty"` + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + NodeID *string `json:"node_id,omitempty"` + HeadBranch *string `json:"head_branch,omitempty"` + HeadSHA *string `json:"head_sha,omitempty"` + RunNumber *int `json:"run_number,omitempty"` + RunAttempt *int `json:"run_attempt,omitempty"` + Event *string `json:"event,omitempty"` + Status *string `json:"status,omitempty"` + Conclusion *string `json:"conclusion,omitempty"` + WorkflowID *int64 `json:"workflow_id,omitempty"` + CheckSuiteID *int64 `json:"check_suite_id,omitempty"` + CheckSuiteNodeID *string `json:"check_suite_node_id,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + PullRequests []*PullRequest `json:"pull_requests,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + RunStartedAt *Timestamp `json:"run_started_at,omitempty"` + JobsURL *string `json:"jobs_url,omitempty"` + LogsURL *string `json:"logs_url,omitempty"` + CheckSuiteURL *string `json:"check_suite_url,omitempty"` + ArtifactsURL *string `json:"artifacts_url,omitempty"` + CancelURL *string `json:"cancel_url,omitempty"` + RerunURL *string `json:"rerun_url,omitempty"` + PreviousAttemptURL *string `json:"previous_attempt_url,omitempty"` + HeadCommit *HeadCommit `json:"head_commit,omitempty"` + WorkflowURL *string `json:"workflow_url,omitempty"` + Repository *Repository `json:"repository,omitempty"` + HeadRepository *Repository `json:"head_repository,omitempty"` } // WorkflowRuns represents a slice of repository action workflow run. diff --git a/github/actions_workflow_runs_test.go b/github/actions_workflow_runs_test.go index d3623621f50..7ebdbf58b33 100644 --- a/github/actions_workflow_runs_test.go +++ b/github/actions_workflow_runs_test.go @@ -464,6 +464,7 @@ func TestWorkflowRun_Marshal(t *testing.T) { HeadBranch: String("hb"), HeadSHA: String("hs"), RunNumber: Int(1), + RunAttempt: Int(1), Event: String("e"), Status: String("s"), Conclusion: String("c"), @@ -495,14 +496,16 @@ func TestWorkflowRun_Marshal(t *testing.T) { }, }, }, - CreatedAt: &Timestamp{referenceTime}, - UpdatedAt: &Timestamp{referenceTime}, - JobsURL: String("j"), - LogsURL: String("l"), - CheckSuiteURL: String("c"), - ArtifactsURL: String("a"), - CancelURL: String("c"), - RerunURL: String("r"), + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + RunStartedAt: &Timestamp{referenceTime}, + JobsURL: String("j"), + LogsURL: String("l"), + CheckSuiteURL: String("c"), + ArtifactsURL: String("a"), + CancelURL: String("c"), + RerunURL: String("r"), + PreviousAttemptURL: String("p"), HeadCommit: &HeadCommit{ Message: String("m"), Author: &CommitAuthor{ @@ -542,6 +545,7 @@ func TestWorkflowRun_Marshal(t *testing.T) { "head_branch": "hb", "head_sha": "hs", "run_number": 1, + "run_attempt": 1, "event": "e", "status": "s", "conclusion": "c", @@ -575,12 +579,14 @@ func TestWorkflowRun_Marshal(t *testing.T) { ], "created_at": ` + referenceTimeStr + `, "updated_at": ` + referenceTimeStr + `, + "run_started_at": ` + referenceTimeStr + `, "jobs_url": "j", "logs_url": "l", "check_suite_url": "c", "artifacts_url": "a", "cancel_url": "c", "rerun_url": "r", + "previous_attempt_url": "p", "head_commit": { "message": "m", "author": { @@ -629,6 +635,7 @@ func TestWorkflowRuns_Marshal(t *testing.T) { HeadBranch: String("hb"), HeadSHA: String("hs"), RunNumber: Int(1), + RunAttempt: Int(1), Event: String("e"), Status: String("s"), Conclusion: String("c"), @@ -660,14 +667,16 @@ func TestWorkflowRuns_Marshal(t *testing.T) { }, }, }, - CreatedAt: &Timestamp{referenceTime}, - UpdatedAt: &Timestamp{referenceTime}, - JobsURL: String("j"), - LogsURL: String("l"), - CheckSuiteURL: String("c"), - ArtifactsURL: String("a"), - CancelURL: String("c"), - RerunURL: String("r"), + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + RunStartedAt: &Timestamp{referenceTime}, + JobsURL: String("j"), + LogsURL: String("l"), + CheckSuiteURL: String("c"), + ArtifactsURL: String("a"), + CancelURL: String("c"), + RerunURL: String("r"), + PreviousAttemptURL: String("p"), HeadCommit: &HeadCommit{ Message: String("m"), Author: &CommitAuthor{ @@ -712,6 +721,7 @@ func TestWorkflowRuns_Marshal(t *testing.T) { "head_branch": "hb", "head_sha": "hs", "run_number": 1, + "run_attempt": 1, "event": "e", "status": "s", "conclusion": "c", @@ -745,12 +755,14 @@ func TestWorkflowRuns_Marshal(t *testing.T) { ], "created_at": ` + referenceTimeStr + `, "updated_at": ` + referenceTimeStr + `, + "run_started_at": ` + referenceTimeStr + `, "jobs_url": "j", "logs_url": "l", "check_suite_url": "c", "artifacts_url": "a", "cancel_url": "c", "rerun_url": "r", + "previous_attempt_url": "p", "head_commit": { "message": "m", "author": { diff --git a/github/event_types_test.go b/github/event_types_test.go index bb5dd40d5dd..a434a009bff 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -8359,6 +8359,7 @@ func TestWorkflowRunEvent_Marshal(t *testing.T) { HeadBranch: String("hb"), HeadSHA: String("hs"), RunNumber: Int(1), + RunAttempt: Int(1), Event: String("e"), Status: String("s"), Conclusion: String("c"), @@ -8390,14 +8391,16 @@ func TestWorkflowRunEvent_Marshal(t *testing.T) { }, }, }, - CreatedAt: &Timestamp{referenceTime}, - UpdatedAt: &Timestamp{referenceTime}, - JobsURL: String("j"), - LogsURL: String("l"), - CheckSuiteURL: String("c"), - ArtifactsURL: String("a"), - CancelURL: String("c"), - RerunURL: String("r"), + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + RunStartedAt: &Timestamp{referenceTime}, + JobsURL: String("j"), + LogsURL: String("l"), + CheckSuiteURL: String("c"), + ArtifactsURL: String("a"), + CancelURL: String("c"), + RerunURL: String("r"), + PreviousAttemptURL: String("p"), HeadCommit: &HeadCommit{ Message: String("m"), Author: &CommitAuthor{ @@ -8488,6 +8491,7 @@ func TestWorkflowRunEvent_Marshal(t *testing.T) { "head_branch": "hb", "head_sha": "hs", "run_number": 1, + "run_attempt": 1, "event": "e", "status": "s", "conclusion": "c", @@ -8521,12 +8525,14 @@ func TestWorkflowRunEvent_Marshal(t *testing.T) { ], "created_at": ` + referenceTimeStr + `, "updated_at": ` + referenceTimeStr + `, + "run_started_at": ` + referenceTimeStr + `, "jobs_url": "j", "logs_url": "l", "check_suite_url": "c", "artifacts_url": "a", "cancel_url": "c", "rerun_url": "r", + "previous_attempt_url": "p", "head_commit": { "message": "m", "author": { diff --git a/github/github-accessors.go b/github/github-accessors.go index 69e3499e394..7ed9610d412 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -18860,6 +18860,14 @@ func (w *WorkflowRun) GetNodeID() string { return *w.NodeID } +// GetPreviousAttemptURL returns the PreviousAttemptURL field if it's non-nil, zero value otherwise. +func (w *WorkflowRun) GetPreviousAttemptURL() string { + if w == nil || w.PreviousAttemptURL == nil { + return "" + } + return *w.PreviousAttemptURL +} + // GetRepository returns the Repository field. func (w *WorkflowRun) GetRepository() *Repository { if w == nil { @@ -18876,6 +18884,14 @@ func (w *WorkflowRun) GetRerunURL() string { return *w.RerunURL } +// GetRunAttempt returns the RunAttempt field if it's non-nil, zero value otherwise. +func (w *WorkflowRun) GetRunAttempt() int { + if w == nil || w.RunAttempt == nil { + return 0 + } + return *w.RunAttempt +} + // GetRunNumber returns the RunNumber field if it's non-nil, zero value otherwise. func (w *WorkflowRun) GetRunNumber() int { if w == nil || w.RunNumber == nil { @@ -18884,6 +18900,14 @@ func (w *WorkflowRun) GetRunNumber() int { return *w.RunNumber } +// GetRunStartedAt returns the RunStartedAt field if it's non-nil, zero value otherwise. +func (w *WorkflowRun) GetRunStartedAt() Timestamp { + if w == nil || w.RunStartedAt == nil { + return Timestamp{} + } + return *w.RunStartedAt +} + // GetStatus returns the Status field if it's non-nil, zero value otherwise. func (w *WorkflowRun) GetStatus() string { if w == nil || w.Status == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 27e0ab14275..2dfed628c2e 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -22079,6 +22079,16 @@ func TestWorkflowRun_GetNodeID(tt *testing.T) { w.GetNodeID() } +func TestWorkflowRun_GetPreviousAttemptURL(tt *testing.T) { + var zeroValue string + w := &WorkflowRun{PreviousAttemptURL: &zeroValue} + w.GetPreviousAttemptURL() + w = &WorkflowRun{} + w.GetPreviousAttemptURL() + w = nil + w.GetPreviousAttemptURL() +} + func TestWorkflowRun_GetRepository(tt *testing.T) { w := &WorkflowRun{} w.GetRepository() @@ -22096,6 +22106,16 @@ func TestWorkflowRun_GetRerunURL(tt *testing.T) { w.GetRerunURL() } +func TestWorkflowRun_GetRunAttempt(tt *testing.T) { + var zeroValue int + w := &WorkflowRun{RunAttempt: &zeroValue} + w.GetRunAttempt() + w = &WorkflowRun{} + w.GetRunAttempt() + w = nil + w.GetRunAttempt() +} + func TestWorkflowRun_GetRunNumber(tt *testing.T) { var zeroValue int w := &WorkflowRun{RunNumber: &zeroValue} @@ -22106,6 +22126,16 @@ func TestWorkflowRun_GetRunNumber(tt *testing.T) { w.GetRunNumber() } +func TestWorkflowRun_GetRunStartedAt(tt *testing.T) { + var zeroValue Timestamp + w := &WorkflowRun{RunStartedAt: &zeroValue} + w.GetRunStartedAt() + w = &WorkflowRun{} + w.GetRunStartedAt() + w = nil + w.GetRunStartedAt() +} + func TestWorkflowRun_GetStatus(tt *testing.T) { var zeroValue string w := &WorkflowRun{Status: &zeroValue}