From 0a2b93d411e8b5685a584be069da07dfc163f03c Mon Sep 17 00:00:00 2001
From: Jason Song <i@wolfogre.com>
Date: Wed, 18 Oct 2023 23:52:44 +0800
Subject: [PATCH] Fix typo "GetLatestRunnerToken" (#27680)

---
 models/actions/runner_token.go        | 4 ++--
 routers/private/actions.go            | 2 +-
 routers/web/shared/actions/runners.go | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/models/actions/runner_token.go b/models/actions/runner_token.go
index cf4e90f3f1..ccd9bbccb3 100644
--- a/models/actions/runner_token.go
+++ b/models/actions/runner_token.go
@@ -82,8 +82,8 @@ func NewRunnerToken(ctx context.Context, ownerID, repoID int64) (*ActionRunnerTo
 	})
 }
 
-// GetLastestRunnerToken returns the latest runner token
-func GetLastestRunnerToken(ctx context.Context, ownerID, repoID int64) (*ActionRunnerToken, error) {
+// GetLatestRunnerToken returns the latest runner token
+func GetLatestRunnerToken(ctx context.Context, ownerID, repoID int64) (*ActionRunnerToken, error) {
 	var runnerToken ActionRunnerToken
 	has, err := db.GetEngine(ctx).Where("owner_id=? AND repo_id=?", ownerID, repoID).
 		OrderBy("id DESC").Get(&runnerToken)
diff --git a/routers/private/actions.go b/routers/private/actions.go
index 025a6a2c39..886f23b1c2 100644
--- a/routers/private/actions.go
+++ b/routers/private/actions.go
@@ -41,7 +41,7 @@ func GenerateActionsRunnerToken(ctx *context.PrivateContext) {
 		})
 	}
 
-	token, err := actions_model.GetLastestRunnerToken(ctx, owner, repo)
+	token, err := actions_model.GetLatestRunnerToken(ctx, owner, repo)
 	if errors.Is(err, util.ErrNotExist) || (token != nil && !token.IsActive) {
 		token, err = actions_model.NewRunnerToken(ctx, owner, repo)
 		if err != nil {
diff --git a/routers/web/shared/actions/runners.go b/routers/web/shared/actions/runners.go
index cd60e9cbee..1da4ddf14f 100644
--- a/routers/web/shared/actions/runners.go
+++ b/routers/web/shared/actions/runners.go
@@ -35,7 +35,7 @@ func RunnersList(ctx *context.Context, opts actions_model.FindRunnerOptions) {
 
 	// ownid=0,repo_id=0,means this token is used for global
 	var token *actions_model.ActionRunnerToken
-	token, err = actions_model.GetLastestRunnerToken(ctx, opts.OwnerID, opts.RepoID)
+	token, err = actions_model.GetLatestRunnerToken(ctx, opts.OwnerID, opts.RepoID)
 	if errors.Is(err, util.ErrNotExist) || (token != nil && !token.IsActive) {
 		token, err = actions_model.NewRunnerToken(ctx, opts.OwnerID, opts.RepoID)
 		if err != nil {
@@ -43,7 +43,7 @@ func RunnersList(ctx *context.Context, opts actions_model.FindRunnerOptions) {
 			return
 		}
 	} else if err != nil {
-		ctx.ServerError("GetLastestRunnerToken", err)
+		ctx.ServerError("GetLatestRunnerToken", err)
 		return
 	}