address oliverpool comments
This commit is contained in:
parent
481d813539
commit
d8f313f9e2
1 changed files with 5 additions and 4 deletions
|
@ -45,21 +45,22 @@ func runActions(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Bool("registration-token-admin") {
|
if ctx.Bool("registration-token-admin") {
|
||||||
return runActionsRegistrationToken(ctx, stdCtx, 0, 0)
|
// ownid=0,repo_id=0,means this token is used for global
|
||||||
|
return runActionsRegistrationToken(stdCtx, 0, 0)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func runActionsRegistrationToken(ctx *cli.Context, stdCtx context.Context, ownerID, repoID int64) error {
|
func runActionsRegistrationToken(stdCtx context.Context, ownerID, repoID int64) error {
|
||||||
var token *actions_model.ActionRunnerToken
|
var token *actions_model.ActionRunnerToken
|
||||||
token, err := actions_model.GetUnactivatedRunnerToken(stdCtx, ownerID, repoID)
|
token, err := actions_model.GetUnactivatedRunnerToken(stdCtx, ownerID, repoID)
|
||||||
if errors.Is(err, util.ErrNotExist) {
|
if errors.Is(err, util.ErrNotExist) {
|
||||||
token, err = actions_model.NewRunnerToken(stdCtx, ownerID, repoID)
|
token, err = actions_model.NewRunnerToken(stdCtx, ownerID, repoID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("CreateRunnerToken", err)
|
log.Fatalf("CreateRunnerToken %v", err)
|
||||||
}
|
}
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
log.Fatalf("GetUnactivatedRunnerToken", err)
|
log.Fatalf("GetUnactivatedRunnerToken %v", err)
|
||||||
}
|
}
|
||||||
fmt.Printf(token.Token)
|
fmt.Printf(token.Token)
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue