refactor: rename model
This commit is contained in:
@@ -52,7 +52,7 @@ func (s *Service) Register(
|
||||
}
|
||||
|
||||
// create new runner
|
||||
runner := &actions_model.BotRunner{
|
||||
runner := &actions_model.ActionRunner{
|
||||
UUID: gouuid.New().String(),
|
||||
Name: req.Msg.Name,
|
||||
OwnerID: runnerToken.OwnerID,
|
||||
@@ -231,7 +231,7 @@ func (s *Service) UpdateLog(
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func pickTask(ctx context.Context, runner *actions_model.BotRunner) (*runnerv1.Task, bool, error) {
|
||||
func pickTask(ctx context.Context, runner *actions_model.ActionRunner) (*runnerv1.Task, bool, error) {
|
||||
t, ok, err := actions_model.CreateTaskForRunner(ctx, runner)
|
||||
if err != nil {
|
||||
return nil, false, fmt.Errorf("CreateTaskForRunner: %w", err)
|
||||
@@ -249,7 +249,7 @@ func pickTask(ctx context.Context, runner *actions_model.BotRunner) (*runnerv1.T
|
||||
return task, true, nil
|
||||
}
|
||||
|
||||
func getSecretsOfTask(ctx context.Context, task *actions_model.BotTask) map[string]string {
|
||||
func getSecretsOfTask(ctx context.Context, task *actions_model.ActionTask) map[string]string {
|
||||
// Returning an error is worse than returning empty secrets.
|
||||
|
||||
secrets := map[string]string{}
|
||||
@@ -289,7 +289,7 @@ func getSecretsOfTask(ctx context.Context, task *actions_model.BotTask) map[stri
|
||||
return secrets
|
||||
}
|
||||
|
||||
func generateTaskContext(t *actions_model.BotTask) *structpb.Struct {
|
||||
func generateTaskContext(t *actions_model.ActionTask) *structpb.Struct {
|
||||
event := map[string]interface{}{}
|
||||
_ = json.Unmarshal([]byte(t.Job.Run.EventPayload), &event)
|
||||
|
||||
|
||||
@@ -67,9 +67,9 @@ func getMethodName(req connect.AnyRequest) string {
|
||||
|
||||
type runnerCtxKey struct{}
|
||||
|
||||
func GetRunner(ctx context.Context) *actions_model.BotRunner {
|
||||
func GetRunner(ctx context.Context) *actions_model.ActionRunner {
|
||||
if v := ctx.Value(runnerCtxKey{}); v != nil {
|
||||
if r, ok := v.(*actions_model.BotRunner); ok {
|
||||
if r, ok := v.(*actions_model.ActionRunner); ok {
|
||||
return r
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ func RunnersList(ctx *context.Context, tplName base.TplName, opts actions_model.
|
||||
}
|
||||
|
||||
// ownid=0,repo_id=0,means this token is used for global
|
||||
var token *actions_model.BotRunnerToken
|
||||
var token *actions_model.ActionRunnerToken
|
||||
token, err = actions_model.GetUnactivatedRunnerToken(opts.OwnerID, opts.RepoID)
|
||||
if _, ok := err.(actions_model.ErrRunnerTokenNotExist); ok {
|
||||
token, err = actions_model.NewRunnerToken(opts.OwnerID, opts.RepoID)
|
||||
|
||||
@@ -125,7 +125,7 @@ func ViewPost(ctx *context_module.Context) {
|
||||
},
|
||||
}
|
||||
|
||||
var task *actions_model.BotTask
|
||||
var task *actions_model.ActionTask
|
||||
if current.TaskID > 0 {
|
||||
var err error
|
||||
task, err = actions_model.GetTaskByID(ctx, current.TaskID)
|
||||
@@ -268,7 +268,7 @@ func Cancel(ctx *context_module.Context) {
|
||||
// getRunJobs gets the jobs of runIndex, and returns jobs[jobIndex], jobs.
|
||||
// Any error will be written to the ctx.
|
||||
// It never returns a nil job of an empty jobs, if the jobIndex is out of range, it will be treated as 0.
|
||||
func getRunJobs(ctx *context_module.Context, runIndex, jobIndex int64) (*actions_model.BotRunJob, []*actions_model.BotRunJob) {
|
||||
func getRunJobs(ctx *context_module.Context, runIndex, jobIndex int64) (*actions_model.ActionRunJob, []*actions_model.ActionRunJob) {
|
||||
run, err := actions_model.GetRunByIndex(ctx, ctx.Repo.Repository.ID, runIndex)
|
||||
if err != nil {
|
||||
if _, ok := err.(actions_model.ErrRunNotExist); ok {
|
||||
|
||||
Reference in New Issue
Block a user