diff --git a/cmd/actions.go b/cmd/actions.go index 3f54ea0..a32670d 100644 --- a/cmd/actions.go +++ b/cmd/actions.go @@ -573,7 +573,7 @@ func runRunView(cmd *cobra.Command, args []string) error { // Case 2: --log or --log-failed (show logs) if showLog || showLogFailed { for _, task := range runTasks { - if err := showJobLog(client, owner, name, run.IndexInRepo, task, showLogFailed); err != nil { + if err := showJobLog(client, owner, name, task, showLogFailed); err != nil { fmt.Printf("\nError fetching log for job %s: %v\n", task.Name, err) } } @@ -710,10 +710,10 @@ func runRunCancel(cmd *cobra.Command, args []string) error { return nil } -func showJobLog(client *api.Client, owner, name string, runNumber int64, task ActionTask, logFailed bool) error { - // Fetch log from /repos/{owner}/{repo}/actions/runs/{run_number}/jobs/{job_id}/logs - logURL := fmt.Sprintf("https://%s/%s/%s/actions/runs/%d/jobs/%d/logs", - client.Hostname(), owner, name, runNumber, task.ID) +func showJobLog(client *api.Client, owner, name string, task ActionTask, logFailed bool) error { + // Fetch log from API: GET /api/v1/repos/{owner}/{repo}/actions/jobs/{job_id}/logs + logURL := fmt.Sprintf("https://%s/api/v1/repos/%s/%s/actions/jobs/%d/logs", + client.Hostname(), owner, name, task.ID) fmt.Printf("\n========================================\n") fmt.Printf("Job: %s (ID: %d)\n", task.Name, task.ID)