@@ -1132,18 +1132,23 @@ func GetWorkflowRun(ctx *context.APIContext) {
1132
1132
// "$ref": "#/responses/notFound"
1133
1133
1134
1134
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
+ }
1136
1140
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
1139
1144
}
1140
1145
1141
- convertedArtifact , err := convert .ToActionWorkflowRun (ctx , ctx .Repo .Repository , job )
1146
+ convertedRun , err := convert .ToActionWorkflowRun (ctx , ctx .Repo .Repository , job )
1142
1147
if err != nil {
1143
1148
ctx .APIErrorInternal (err )
1144
1149
return
1145
1150
}
1146
- ctx .JSON (http .StatusOK , convertedArtifact )
1151
+ ctx .JSON (http .StatusOK , convertedRun )
1147
1152
}
1148
1153
1149
1154
// ListWorkflowRunJobs Lists all jobs for a workflow run.
@@ -1237,10 +1242,15 @@ func GetWorkflowJob(ctx *context.APIContext) {
1237
1242
// "$ref": "#/responses/notFound"
1238
1243
1239
1244
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
+ }
1241
1250
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
1244
1254
}
1245
1255
1246
1256
convertedWorkflowJob , err := convert .ToActionWorkflowJob (ctx , ctx .Repo .Repository , nil , job )
@@ -1251,7 +1261,7 @@ func GetWorkflowJob(ctx *context.APIContext) {
1251
1261
ctx .JSON (http .StatusOK , convertedWorkflowJob )
1252
1262
}
1253
1263
1254
- // GetArtifacts Lists all artifacts for a repository.
1264
+ // GetArtifactsOfRun Lists all artifacts for a repository.
1255
1265
func GetArtifactsOfRun (ctx * context.APIContext ) {
1256
1266
// swagger:operation GET /repos/{owner}/{repo}/actions/runs/{run}/artifacts repository getArtifactsOfRun
1257
1267
// ---
@@ -1354,7 +1364,7 @@ func DeleteActionRun(ctx *context.APIContext) {
1354
1364
runID := ctx .PathParamInt64 ("run" )
1355
1365
run , err := actions_model .GetRunByRepoAndID (ctx , ctx .Repo .Repository .ID , runID )
1356
1366
if errors .Is (err , util .ErrNotExist ) {
1357
- ctx .APIError ( http . StatusNotFound , err )
1367
+ ctx .APIErrorNotFound ( err )
1358
1368
return
1359
1369
} else if err != nil {
1360
1370
ctx .APIErrorInternal (err )
0 commit comments