fix small bug with startup_failure conclusion

This commit is contained in:
vilmibm 2021-04-13 22:03:59 -05:00
parent cadabb4e6d
commit efe7aa1f78
2 changed files with 39 additions and 1 deletions

View file

@ -308,7 +308,7 @@ func runView(opts *ViewOptions) error {
fmt.Fprintln(out, shared.RenderRunHeader(cs, *run, utils.FuzzyAgo(ago), prNumber))
fmt.Fprintln(out)
if len(jobs) == 0 && run.Conclusion == shared.Failure {
if len(jobs) == 0 && run.Conclusion == shared.Failure || run.Conclusion == shared.StartupFailure {
fmt.Fprintf(out, "%s %s\n",
cs.FailureIcon(),
cs.Bold("This run likely failed because of a workflow file issue."))

View file

@ -771,6 +771,44 @@ func TestViewRun(t *testing.T) {
browsedURL: "jobs/10?check_suite_focus=true",
wantOut: "Opening jobs/10 in your browser.\n",
},
{
name: "hide job header, failure",
tty: true,
opts: &ViewOptions{
RunID: "123",
},
httpStubs: func(reg *httpmock.Registry) {
reg.Register(
httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/123"),
httpmock.JSONResponse(shared.TestRun("failed no job", 123, shared.Completed, shared.Failure)))
reg.Register(
httpmock.REST("GET", "runs/123/jobs"),
httpmock.JSONResponse(shared.JobsPayload{Jobs: []shared.Job{}}))
reg.Register(
httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/123/artifacts"),
httpmock.StringResponse(`{}`))
},
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",
},
{
name: "hide job header, startup_failure",
tty: true,
opts: &ViewOptions{
RunID: "123",
},
httpStubs: func(reg *httpmock.Registry) {
reg.Register(
httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/123"),
httpmock.JSONResponse(shared.TestRun("failed no job", 123, shared.Completed, shared.StartupFailure)))
reg.Register(
httpmock.REST("GET", "runs/123/jobs"),
httpmock.JSONResponse(shared.JobsPayload{Jobs: []shared.Job{}}))
reg.Register(
httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/123/artifacts"),
httpmock.StringResponse(`{}`))
},
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",
},
}
for _, tt := range tests {