Skip to content

Commit f37caab

Browse files
committed
fix removed runner could still be retrieved via get
1 parent e2d9774 commit f37caab

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

routers/api/v1/shared/runners.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,9 @@ func GetRunners(ctx *context.APIContext, ownerID, repoID int64) {
5959
}
6060

6161
func GetRunner(ctx *context.APIContext, ownerID, repoID, runnerID int64) {
62-
runner, exists, err := db.GetByID[actions_model.ActionRunner](ctx, runnerID)
62+
runner, err := actions_model.GetRunnerByID(ctx, runnerID)
6363
if err != nil {
64-
ctx.APIErrorInternal(err)
65-
return
66-
}
67-
if !exists {
68-
ctx.APIErrorNotFound("Runner does not exist")
64+
ctx.APIErrorNotFound(err)
6965
return
7066
}
7167
if !runner.Editable(ownerID, repoID) {
@@ -76,15 +72,11 @@ func GetRunner(ctx *context.APIContext, ownerID, repoID, runnerID int64) {
7672
}
7773

7874
func DeleteRunner(ctx *context.APIContext, ownerID, repoID, runnerID int64) {
79-
runner, exists, err := db.GetByID[actions_model.ActionRunner](ctx, runnerID)
75+
runner, err := actions_model.GetRunnerByID(ctx, runnerID)
8076
if err != nil {
8177
ctx.APIErrorInternal(err)
8278
return
8379
}
84-
if !exists {
85-
ctx.APIErrorNotFound("Runner does not exist")
86-
return
87-
}
8880
if !runner.Editable(ownerID, repoID) {
8981
ctx.APIErrorNotFound("No permission to delete this runner")
9082
return

0 commit comments

Comments
 (0)