fix: correctly build the jobs logs url
unfortunately, this is available in gitea, not yet backported to forgejo
This commit is contained in:
parent
a7e5dc5798
commit
1420b89fed
1 changed files with 5 additions and 5 deletions
|
|
@ -573,7 +573,7 @@ func runRunView(cmd *cobra.Command, args []string) error {
|
||||||
// Case 2: --log or --log-failed (show logs)
|
// Case 2: --log or --log-failed (show logs)
|
||||||
if showLog || showLogFailed {
|
if showLog || showLogFailed {
|
||||||
for _, task := range runTasks {
|
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)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func showJobLog(client *api.Client, owner, name string, runNumber int64, task ActionTask, logFailed bool) error {
|
func showJobLog(client *api.Client, owner, name string, task ActionTask, logFailed bool) error {
|
||||||
// Fetch log from /repos/{owner}/{repo}/actions/runs/{run_number}/jobs/{job_id}/logs
|
// Fetch log from API: GET /api/v1/repos/{owner}/{repo}/actions/jobs/{job_id}/logs
|
||||||
logURL := fmt.Sprintf("https://%s/%s/%s/actions/runs/%d/jobs/%d/logs",
|
logURL := fmt.Sprintf("https://%s/api/v1/repos/%s/%s/actions/jobs/%d/logs",
|
||||||
client.Hostname(), owner, name, runNumber, task.ID)
|
client.Hostname(), owner, name, task.ID)
|
||||||
|
|
||||||
fmt.Printf("\n========================================\n")
|
fmt.Printf("\n========================================\n")
|
||||||
fmt.Printf("Job: %s (ID: %d)\n", task.Name, task.ID)
|
fmt.Printf("Job: %s (ID: %d)\n", task.Name, task.ID)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue