mirror of
https://github.com/go-gitea/gitea
synced 2024-12-21 17:17:56 +01:00
Revert wrong change
This commit is contained in:
parent
d31fe7c60f
commit
999338848d
@ -83,9 +83,9 @@ func runSetActionsRunnerToken(c *cli.Context) error {
|
|||||||
setting.MustInstalled()
|
setting.MustInstalled()
|
||||||
|
|
||||||
scope := c.String("scope")
|
scope := c.String("scope")
|
||||||
putToken := c.String("token")
|
token := c.String("token")
|
||||||
|
|
||||||
respText, extra := private.SetActionsRunnerToken(ctx, scope, putToken)
|
respText, extra := private.SetActionsRunnerToken(ctx, scope, token)
|
||||||
if extra.HasError() {
|
if extra.HasError() {
|
||||||
return handleCliResponseExtra(extra)
|
return handleCliResponseExtra(extra)
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type GenerateTokenRequest struct {
|
type GenerateTokenRequest struct {
|
||||||
Scope string
|
Scope string
|
||||||
PutToken string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateActionsRunnerToken calls the internal GenerateActionsRunnerToken function
|
// GenerateActionsRunnerToken calls the internal GenerateActionsRunnerToken function
|
||||||
|
@ -41,12 +41,9 @@ func GenerateActionsRunnerToken(ctx *context.PrivateContext) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var token *actions_model.ActionRunnerToken
|
token, err := actions_model.GetLatestRunnerToken(ctx, owner, repo)
|
||||||
if genRequest.PutToken == "" {
|
if errors.Is(err, util.ErrNotExist) || (token != nil && !token.IsActive) {
|
||||||
token, err = actions_model.GetLatestRunnerToken(ctx, owner, repo)
|
token, err = actions_model.NewRunnerToken(ctx, owner, repo, "")
|
||||||
}
|
|
||||||
if genRequest.PutToken != "" || errors.Is(err, util.ErrNotExist) || (token != nil && !token.IsActive) {
|
|
||||||
token, err = actions_model.NewRunnerToken(ctx, owner, repo, genRequest.PutToken)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMsg := fmt.Sprintf("error while creating runner token: %v", err)
|
errMsg := fmt.Sprintf("error while creating runner token: %v", err)
|
||||||
log.Error("NewRunnerToken failed: %v", errMsg)
|
log.Error("NewRunnerToken failed: %v", errMsg)
|
||||||
|
Loading…
Reference in New Issue
Block a user