From 2ce3279ebc79982ca334c9244f09c7d55071595b Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Wed, 16 Jul 2025 14:17:15 +0100 Subject: [PATCH 1/3] fix(run): add `IsSkipped` function Signed-off-by: Babak K. Shandiz --- pkg/cmd/run/shared/shared.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cmd/run/shared/shared.go b/pkg/cmd/run/shared/shared.go index f085add49..8c191846a 100644 --- a/pkg/cmd/run/shared/shared.go +++ b/pkg/cmd/run/shared/shared.go @@ -319,6 +319,10 @@ func IsFailureState(c Conclusion) bool { } } +func IsSkipped(c Conclusion) bool { + return c == Skipped +} + type RunsPayload struct { TotalCount int `json:"total_count"` WorkflowRuns []Run `json:"workflow_runs"` From 64d5d6c6c82b7454a9ff37ffdb372096df95404a Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Wed, 16 Jul 2025 14:18:27 +0100 Subject: [PATCH 2/3] fix(run view): avoid looking for job log if its been skipped Signed-off-by: Babak K. Shandiz --- pkg/cmd/run/view/logs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cmd/run/view/logs.go b/pkg/cmd/run/view/logs.go index bd99830bb..8961381b3 100644 --- a/pkg/cmd/run/view/logs.go +++ b/pkg/cmd/run/view/logs.go @@ -91,6 +91,10 @@ func populateLogSegments(httpClient *http.Client, repo ghrepo.Interface, jobs [] apiLogFetcherCount := 0 for _, job := range jobs { + if shared.IsSkipped(job.Conclusion) { + continue + } + if onlyFailed && !shared.IsFailureState(job.Conclusion) { continue } From f67bd9a7d1ec6ddd11ec9b12e600d2e557853ed6 Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Wed, 16 Jul 2025 14:19:13 +0100 Subject: [PATCH 3/3] test(run view): assert a skipped job does not cause error Signed-off-by: Babak K. Shandiz --- pkg/cmd/run/shared/test.go | 12 ++++++++++++ pkg/cmd/run/view/view_test.go | 23 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) 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{