Skip to content

Commit 9993388

Browse files
committed
Revert wrong change
1 parent d31fe7c commit 9993388

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

cmd/actions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ func runSetActionsRunnerToken(c *cli.Context) error {
8383
setting.MustInstalled()
8484

8585
scope := c.String("scope")
86-
putToken := c.String("token")
86+
token := c.String("token")
8787

88-
respText, extra := private.SetActionsRunnerToken(ctx, scope, putToken)
88+
respText, extra := private.SetActionsRunnerToken(ctx, scope, token)
8989
if extra.HasError() {
9090
return handleCliResponseExtra(extra)
9191
}

modules/private/actions.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import (
1010
)
1111

1212
type GenerateTokenRequest struct {
13-
Scope string
14-
PutToken string
13+
Scope string
1514
}
1615

1716
// GenerateActionsRunnerToken calls the internal GenerateActionsRunnerToken function

routers/private/actions.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,9 @@ func GenerateActionsRunnerToken(ctx *context.PrivateContext) {
4141
})
4242
}
4343

44-
var token *actions_model.ActionRunnerToken
45-
if genRequest.PutToken == "" {
46-
token, err = actions_model.GetLatestRunnerToken(ctx, owner, repo)
47-
}
48-
if genRequest.PutToken != "" || errors.Is(err, util.ErrNotExist) || (token != nil && !token.IsActive) {
49-
token, err = actions_model.NewRunnerToken(ctx, owner, repo, genRequest.PutToken)
44+
token, err := actions_model.GetLatestRunnerToken(ctx, owner, repo)
45+
if errors.Is(err, util.ErrNotExist) || (token != nil && !token.IsActive) {
46+
token, err = actions_model.NewRunnerToken(ctx, owner, repo, "")
5047
if err != nil {
5148
errMsg := fmt.Sprintf("error while creating runner token: %v", err)
5249
log.Error("NewRunnerToken failed: %v", errMsg)

0 commit comments

Comments
 (0)