diff --git a/pkg/cmd/run/shared/test.go b/pkg/cmd/run/shared/test.go index 5a8a4584e..092067523 100644 --- a/pkg/cmd/run/shared/test.go +++ b/pkg/cmd/run/shared/test.go @@ -158,6 +158,18 @@ var LegacySuccessfulJobWithoutStepLogs Job = Job{ }, } +var SkippedJob Job = Job{ + ID: 13, + Status: Completed, + Conclusion: Skipped, + Name: "cool job", + StartedAt: TestRunStartTime, + CompletedAt: TestRunStartTime, + URL: "https://github.com/jobs/13", + RunID: 3, + Steps: []Step{}, +} + var FailedJob Job = Job{ ID: 20, Status: Completed, diff --git a/pkg/cmd/run/view/view_test.go b/pkg/cmd/run/view/view_test.go index 4c3a6a471..5bcb587d1 100644 --- a/pkg/cmd/run/view/view_test.go +++ b/pkg/cmd/run/view/view_test.go @@ -2254,6 +2254,29 @@ func TestViewRun(t *testing.T) { wantErr: true, errMsg: "job 20 is still in progress; logs will be available when it is complete", }, + { + name: "job log but job is skipped", + tty: false, + opts: &ViewOptions{ + JobID: "13", + Log: true, + }, + httpStubs: func(reg *httpmock.Registry) { + reg.Register( + httpmock.REST("GET", "repos/OWNER/REPO/actions/jobs/13"), + httpmock.JSONResponse(shared.SkippedJob)) + reg.Register( + httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/3"), + httpmock.JSONResponse(shared.SuccessfulRun)) + reg.Register( + httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/3/logs"), + httpmock.BinaryResponse(emptyZipArchive)) + reg.Register( + httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/123"), + httpmock.JSONResponse(shared.TestWorkflow)) + }, + wantOut: "", + }, { name: "noninteractive with job", opts: &ViewOptions{