Skip to content

Commit 4d7a0b5

Browse files
authored
Add PreviousAttemptURL, RunAttempt, RunStartedAt fields to WorkflowRun (#2238)
Fixes: #2237.
1 parent 63a1994 commit 4d7a0b5

File tree

5 files changed

+126
-51
lines changed

5 files changed

+126
-51
lines changed

github/actions_workflow_runs.go

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,36 @@ import (
1414

1515
// WorkflowRun represents a repository action workflow run.
1616
type WorkflowRun struct {
17-
ID *int64 `json:"id,omitempty"`
18-
Name *string `json:"name,omitempty"`
19-
NodeID *string `json:"node_id,omitempty"`
20-
HeadBranch *string `json:"head_branch,omitempty"`
21-
HeadSHA *string `json:"head_sha,omitempty"`
22-
RunNumber *int `json:"run_number,omitempty"`
23-
Event *string `json:"event,omitempty"`
24-
Status *string `json:"status,omitempty"`
25-
Conclusion *string `json:"conclusion,omitempty"`
26-
WorkflowID *int64 `json:"workflow_id,omitempty"`
27-
CheckSuiteID *int64 `json:"check_suite_id,omitempty"`
28-
CheckSuiteNodeID *string `json:"check_suite_node_id,omitempty"`
29-
URL *string `json:"url,omitempty"`
30-
HTMLURL *string `json:"html_url,omitempty"`
31-
PullRequests []*PullRequest `json:"pull_requests,omitempty"`
32-
CreatedAt *Timestamp `json:"created_at,omitempty"`
33-
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
34-
JobsURL *string `json:"jobs_url,omitempty"`
35-
LogsURL *string `json:"logs_url,omitempty"`
36-
CheckSuiteURL *string `json:"check_suite_url,omitempty"`
37-
ArtifactsURL *string `json:"artifacts_url,omitempty"`
38-
CancelURL *string `json:"cancel_url,omitempty"`
39-
RerunURL *string `json:"rerun_url,omitempty"`
40-
HeadCommit *HeadCommit `json:"head_commit,omitempty"`
41-
WorkflowURL *string `json:"workflow_url,omitempty"`
42-
Repository *Repository `json:"repository,omitempty"`
43-
HeadRepository *Repository `json:"head_repository,omitempty"`
17+
ID *int64 `json:"id,omitempty"`
18+
Name *string `json:"name,omitempty"`
19+
NodeID *string `json:"node_id,omitempty"`
20+
HeadBranch *string `json:"head_branch,omitempty"`
21+
HeadSHA *string `json:"head_sha,omitempty"`
22+
RunNumber *int `json:"run_number,omitempty"`
23+
RunAttempt *int `json:"run_attempt,omitempty"`
24+
Event *string `json:"event,omitempty"`
25+
Status *string `json:"status,omitempty"`
26+
Conclusion *string `json:"conclusion,omitempty"`
27+
WorkflowID *int64 `json:"workflow_id,omitempty"`
28+
CheckSuiteID *int64 `json:"check_suite_id,omitempty"`
29+
CheckSuiteNodeID *string `json:"check_suite_node_id,omitempty"`
30+
URL *string `json:"url,omitempty"`
31+
HTMLURL *string `json:"html_url,omitempty"`
32+
PullRequests []*PullRequest `json:"pull_requests,omitempty"`
33+
CreatedAt *Timestamp `json:"created_at,omitempty"`
34+
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
35+
RunStartedAt *Timestamp `json:"run_started_at,omitempty"`
36+
JobsURL *string `json:"jobs_url,omitempty"`
37+
LogsURL *string `json:"logs_url,omitempty"`
38+
CheckSuiteURL *string `json:"check_suite_url,omitempty"`
39+
ArtifactsURL *string `json:"artifacts_url,omitempty"`
40+
CancelURL *string `json:"cancel_url,omitempty"`
41+
RerunURL *string `json:"rerun_url,omitempty"`
42+
PreviousAttemptURL *string `json:"previous_attempt_url,omitempty"`
43+
HeadCommit *HeadCommit `json:"head_commit,omitempty"`
44+
WorkflowURL *string `json:"workflow_url,omitempty"`
45+
Repository *Repository `json:"repository,omitempty"`
46+
HeadRepository *Repository `json:"head_repository,omitempty"`
4447
}
4548

4649
// WorkflowRuns represents a slice of repository action workflow run.

github/actions_workflow_runs_test.go

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ func TestWorkflowRun_Marshal(t *testing.T) {
464464
HeadBranch: String("hb"),
465465
HeadSHA: String("hs"),
466466
RunNumber: Int(1),
467+
RunAttempt: Int(1),
467468
Event: String("e"),
468469
Status: String("s"),
469470
Conclusion: String("c"),
@@ -495,14 +496,16 @@ func TestWorkflowRun_Marshal(t *testing.T) {
495496
},
496497
},
497498
},
498-
CreatedAt: &Timestamp{referenceTime},
499-
UpdatedAt: &Timestamp{referenceTime},
500-
JobsURL: String("j"),
501-
LogsURL: String("l"),
502-
CheckSuiteURL: String("c"),
503-
ArtifactsURL: String("a"),
504-
CancelURL: String("c"),
505-
RerunURL: String("r"),
499+
CreatedAt: &Timestamp{referenceTime},
500+
UpdatedAt: &Timestamp{referenceTime},
501+
RunStartedAt: &Timestamp{referenceTime},
502+
JobsURL: String("j"),
503+
LogsURL: String("l"),
504+
CheckSuiteURL: String("c"),
505+
ArtifactsURL: String("a"),
506+
CancelURL: String("c"),
507+
RerunURL: String("r"),
508+
PreviousAttemptURL: String("p"),
506509
HeadCommit: &HeadCommit{
507510
Message: String("m"),
508511
Author: &CommitAuthor{
@@ -542,6 +545,7 @@ func TestWorkflowRun_Marshal(t *testing.T) {
542545
"head_branch": "hb",
543546
"head_sha": "hs",
544547
"run_number": 1,
548+
"run_attempt": 1,
545549
"event": "e",
546550
"status": "s",
547551
"conclusion": "c",
@@ -575,12 +579,14 @@ func TestWorkflowRun_Marshal(t *testing.T) {
575579
],
576580
"created_at": ` + referenceTimeStr + `,
577581
"updated_at": ` + referenceTimeStr + `,
582+
"run_started_at": ` + referenceTimeStr + `,
578583
"jobs_url": "j",
579584
"logs_url": "l",
580585
"check_suite_url": "c",
581586
"artifacts_url": "a",
582587
"cancel_url": "c",
583588
"rerun_url": "r",
589+
"previous_attempt_url": "p",
584590
"head_commit": {
585591
"message": "m",
586592
"author": {
@@ -629,6 +635,7 @@ func TestWorkflowRuns_Marshal(t *testing.T) {
629635
HeadBranch: String("hb"),
630636
HeadSHA: String("hs"),
631637
RunNumber: Int(1),
638+
RunAttempt: Int(1),
632639
Event: String("e"),
633640
Status: String("s"),
634641
Conclusion: String("c"),
@@ -660,14 +667,16 @@ func TestWorkflowRuns_Marshal(t *testing.T) {
660667
},
661668
},
662669
},
663-
CreatedAt: &Timestamp{referenceTime},
664-
UpdatedAt: &Timestamp{referenceTime},
665-
JobsURL: String("j"),
666-
LogsURL: String("l"),
667-
CheckSuiteURL: String("c"),
668-
ArtifactsURL: String("a"),
669-
CancelURL: String("c"),
670-
RerunURL: String("r"),
670+
CreatedAt: &Timestamp{referenceTime},
671+
UpdatedAt: &Timestamp{referenceTime},
672+
RunStartedAt: &Timestamp{referenceTime},
673+
JobsURL: String("j"),
674+
LogsURL: String("l"),
675+
CheckSuiteURL: String("c"),
676+
ArtifactsURL: String("a"),
677+
CancelURL: String("c"),
678+
RerunURL: String("r"),
679+
PreviousAttemptURL: String("p"),
671680
HeadCommit: &HeadCommit{
672681
Message: String("m"),
673682
Author: &CommitAuthor{
@@ -712,6 +721,7 @@ func TestWorkflowRuns_Marshal(t *testing.T) {
712721
"head_branch": "hb",
713722
"head_sha": "hs",
714723
"run_number": 1,
724+
"run_attempt": 1,
715725
"event": "e",
716726
"status": "s",
717727
"conclusion": "c",
@@ -745,12 +755,14 @@ func TestWorkflowRuns_Marshal(t *testing.T) {
745755
],
746756
"created_at": ` + referenceTimeStr + `,
747757
"updated_at": ` + referenceTimeStr + `,
758+
"run_started_at": ` + referenceTimeStr + `,
748759
"jobs_url": "j",
749760
"logs_url": "l",
750761
"check_suite_url": "c",
751762
"artifacts_url": "a",
752763
"cancel_url": "c",
753764
"rerun_url": "r",
765+
"previous_attempt_url": "p",
754766
"head_commit": {
755767
"message": "m",
756768
"author": {

github/event_types_test.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8359,6 +8359,7 @@ func TestWorkflowRunEvent_Marshal(t *testing.T) {
83598359
HeadBranch: String("hb"),
83608360
HeadSHA: String("hs"),
83618361
RunNumber: Int(1),
8362+
RunAttempt: Int(1),
83628363
Event: String("e"),
83638364
Status: String("s"),
83648365
Conclusion: String("c"),
@@ -8390,14 +8391,16 @@ func TestWorkflowRunEvent_Marshal(t *testing.T) {
83908391
},
83918392
},
83928393
},
8393-
CreatedAt: &Timestamp{referenceTime},
8394-
UpdatedAt: &Timestamp{referenceTime},
8395-
JobsURL: String("j"),
8396-
LogsURL: String("l"),
8397-
CheckSuiteURL: String("c"),
8398-
ArtifactsURL: String("a"),
8399-
CancelURL: String("c"),
8400-
RerunURL: String("r"),
8394+
CreatedAt: &Timestamp{referenceTime},
8395+
UpdatedAt: &Timestamp{referenceTime},
8396+
RunStartedAt: &Timestamp{referenceTime},
8397+
JobsURL: String("j"),
8398+
LogsURL: String("l"),
8399+
CheckSuiteURL: String("c"),
8400+
ArtifactsURL: String("a"),
8401+
CancelURL: String("c"),
8402+
RerunURL: String("r"),
8403+
PreviousAttemptURL: String("p"),
84018404
HeadCommit: &HeadCommit{
84028405
Message: String("m"),
84038406
Author: &CommitAuthor{
@@ -8488,6 +8491,7 @@ func TestWorkflowRunEvent_Marshal(t *testing.T) {
84888491
"head_branch": "hb",
84898492
"head_sha": "hs",
84908493
"run_number": 1,
8494+
"run_attempt": 1,
84918495
"event": "e",
84928496
"status": "s",
84938497
"conclusion": "c",
@@ -8521,12 +8525,14 @@ func TestWorkflowRunEvent_Marshal(t *testing.T) {
85218525
],
85228526
"created_at": ` + referenceTimeStr + `,
85238527
"updated_at": ` + referenceTimeStr + `,
8528+
"run_started_at": ` + referenceTimeStr + `,
85248529
"jobs_url": "j",
85258530
"logs_url": "l",
85268531
"check_suite_url": "c",
85278532
"artifacts_url": "a",
85288533
"cancel_url": "c",
85298534
"rerun_url": "r",
8535+
"previous_attempt_url": "p",
85308536
"head_commit": {
85318537
"message": "m",
85328538
"author": {

github/github-accessors.go

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)