Skip to content

Commit efe7aa1

Browse files
committed
fix small bug with startup_failure conclusion
1 parent cadabb4 commit efe7aa1

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

pkg/cmd/run/view/view.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ func runView(opts *ViewOptions) error {
308308
fmt.Fprintln(out, shared.RenderRunHeader(cs, *run, utils.FuzzyAgo(ago), prNumber))
309309
fmt.Fprintln(out)
310310

311-
if len(jobs) == 0 && run.Conclusion == shared.Failure {
311+
if len(jobs) == 0 && run.Conclusion == shared.Failure || run.Conclusion == shared.StartupFailure {
312312
fmt.Fprintf(out, "%s %s\n",
313313
cs.FailureIcon(),
314314
cs.Bold("This run likely failed because of a workflow file issue."))

pkg/cmd/run/view/view_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,44 @@ func TestViewRun(t *testing.T) {
771771
browsedURL: "jobs/10?check_suite_focus=true",
772772
wantOut: "Opening jobs/10 in your browser.\n",
773773
},
774+
{
775+
name: "hide job header, failure",
776+
tty: true,
777+
opts: &ViewOptions{
778+
RunID: "123",
779+
},
780+
httpStubs: func(reg *httpmock.Registry) {
781+
reg.Register(
782+
httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/123"),
783+
httpmock.JSONResponse(shared.TestRun("failed no job", 123, shared.Completed, shared.Failure)))
784+
reg.Register(
785+
httpmock.REST("GET", "runs/123/jobs"),
786+
httpmock.JSONResponse(shared.JobsPayload{Jobs: []shared.Job{}}))
787+
reg.Register(
788+
httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/123/artifacts"),
789+
httpmock.StringResponse(`{}`))
790+
},
791+
wantOut: "\nX trunk failed no job · 123\nTriggered via push about 59 minutes ago\n\nX This run likely failed because of a workflow file issue.\n\nFor more information, see: runs/123\n",
792+
},
793+
{
794+
name: "hide job header, startup_failure",
795+
tty: true,
796+
opts: &ViewOptions{
797+
RunID: "123",
798+
},
799+
httpStubs: func(reg *httpmock.Registry) {
800+
reg.Register(
801+
httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/123"),
802+
httpmock.JSONResponse(shared.TestRun("failed no job", 123, shared.Completed, shared.StartupFailure)))
803+
reg.Register(
804+
httpmock.REST("GET", "runs/123/jobs"),
805+
httpmock.JSONResponse(shared.JobsPayload{Jobs: []shared.Job{}}))
806+
reg.Register(
807+
httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/123/artifacts"),
808+
httpmock.StringResponse(`{}`))
809+
},
810+
wantOut: "\nX trunk failed no job · 123\nTriggered via push about 59 minutes ago\n\nX This run likely failed because of a workflow file issue.\n\nFor more information, see: runs/123\n",
811+
},
774812
}
775813

776814
for _, tt := range tests {

0 commit comments

Comments
 (0)