Skip to content

Commit be0c0bd

Browse files
committed
Fix test job ID and add LoadRun check in rerunJob
1 parent 1f2b885 commit be0c0bd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

routers/api/v1/repo/actions_run.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,11 @@ func getRunJobsAndCurrent(ctx *context.APIContext, runID, jobIndex int64) (*acti
531531
}
532532

533533
func rerunJob(ctx *context.APIContext, job *actions_model.ActionRunJob, shouldBlock bool) error {
534+
if job.Run == nil {
535+
if err := job.LoadRun(ctx); err != nil {
536+
return err
537+
}
538+
}
534539
status := job.Status
535540
if !status.IsDone() || !job.Run.Status.IsDone() {
536541
return nil

tests/integration/api_actions_run_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func TestAPIActionsGetWorkflowJobLogs(t *testing.T) {
272272
session := loginUser(t, user.Name)
273273
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
274274

275-
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/795/jobs/198/logs", repo.FullName())).
275+
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/795/jobs/192/logs", repo.FullName())).
276276
AddTokenAuth(token)
277277
MakeRequest(t, req, http.StatusOK)
278278

0 commit comments

Comments
 (0)