@@ -1132,18 +1132,23 @@ func GetWorkflowRun(ctx *context.APIContext) {
11321132 // "$ref": "#/responses/notFound"
11331133
11341134 runID := ctx .PathParamInt64 ("run" )
1135- job , _ , err := db .GetByID [actions_model.ActionRun ](ctx , runID )
1135+ job , has , err := db .GetByID [actions_model.ActionRun ](ctx , runID )
1136+ if err != nil {
1137+ ctx .APIErrorInternal (err )
1138+ return
1139+ }
11361140
1137- if err != nil || job .RepoID != ctx .Repo .Repository .ID {
1138- ctx .APIError (http .StatusNotFound , util .ErrNotExist )
1141+ if ! has || job .RepoID != ctx .Repo .Repository .ID {
1142+ ctx .APIErrorNotFound (util .ErrNotExist )
1143+ return
11391144 }
11401145
1141- convertedArtifact , err := convert .ToActionWorkflowRun (ctx , ctx .Repo .Repository , job )
1146+ convertedRun , err := convert .ToActionWorkflowRun (ctx , ctx .Repo .Repository , job )
11421147 if err != nil {
11431148 ctx .APIErrorInternal (err )
11441149 return
11451150 }
1146- ctx .JSON (http .StatusOK , convertedArtifact )
1151+ ctx .JSON (http .StatusOK , convertedRun )
11471152}
11481153
11491154// ListWorkflowRunJobs Lists all jobs for a workflow run.
@@ -1237,10 +1242,15 @@ func GetWorkflowJob(ctx *context.APIContext) {
12371242 // "$ref": "#/responses/notFound"
12381243
12391244 jobID := ctx .PathParamInt64 ("job_id" )
1240- job , _ , err := db .GetByID [actions_model.ActionRunJob ](ctx , jobID )
1245+ job , has , err := db .GetByID [actions_model.ActionRunJob ](ctx , jobID )
1246+ if err != nil {
1247+ ctx .APIErrorInternal (err )
1248+ return
1249+ }
12411250
1242- if err != nil || job .RepoID != ctx .Repo .Repository .ID {
1243- ctx .APIError (http .StatusNotFound , util .ErrNotExist )
1251+ if ! has || job .RepoID != ctx .Repo .Repository .ID {
1252+ ctx .APIErrorNotFound (util .ErrNotExist )
1253+ return
12441254 }
12451255
12461256 convertedWorkflowJob , err := convert .ToActionWorkflowJob (ctx , ctx .Repo .Repository , nil , job )
@@ -1251,7 +1261,7 @@ func GetWorkflowJob(ctx *context.APIContext) {
12511261 ctx .JSON (http .StatusOK , convertedWorkflowJob )
12521262}
12531263
1254- // GetArtifacts Lists all artifacts for a repository.
1264+ // GetArtifactsOfRun Lists all artifacts for a repository.
12551265func GetArtifactsOfRun (ctx * context.APIContext ) {
12561266 // swagger:operation GET /repos/{owner}/{repo}/actions/runs/{run}/artifacts repository getArtifactsOfRun
12571267 // ---
@@ -1354,7 +1364,7 @@ func DeleteActionRun(ctx *context.APIContext) {
13541364 runID := ctx .PathParamInt64 ("run" )
13551365 run , err := actions_model .GetRunByRepoAndID (ctx , ctx .Repo .Repository .ID , runID )
13561366 if errors .Is (err , util .ErrNotExist ) {
1357- ctx .APIError ( http . StatusNotFound , err )
1367+ ctx .APIErrorNotFound ( err )
13581368 return
13591369 } else if err != nil {
13601370 ctx .APIErrorInternal (err )
0 commit comments