mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
refactor: rename to actions
This commit is contained in:
@@ -51,7 +51,7 @@ func init() {
|
||||
}
|
||||
|
||||
func (run *ActionRun) HTMLURL() string {
|
||||
return fmt.Sprintf("%s/bots/runs/%d", run.Repo.HTMLURL(), run.Index)
|
||||
return fmt.Sprintf("%s/actions/runs/%d", run.Repo.HTMLURL(), run.Index)
|
||||
}
|
||||
|
||||
// LoadAttributes load Repo TriggerUser if not loaded
|
||||
@@ -108,11 +108,11 @@ func (run *ActionRun) GetPushEventPayload() (*api.PushPayload, error) {
|
||||
func updateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) error {
|
||||
_, err := db.GetEngine(ctx).ID(repo.ID).
|
||||
SetExpr("num_runs",
|
||||
builder.Select("count(*)").From("bot_run").
|
||||
builder.Select("count(*)").From("action_run").
|
||||
Where(builder.Eq{"repo_id": repo.ID}),
|
||||
).
|
||||
SetExpr("num_closed_runs",
|
||||
builder.Select("count(*)").From("bot_run").
|
||||
builder.Select("count(*)").From("action_run").
|
||||
Where(builder.Eq{
|
||||
"repo_id": repo.ID,
|
||||
}.And(
|
||||
@@ -129,7 +129,7 @@ func updateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) err
|
||||
return err
|
||||
}
|
||||
|
||||
// InsertRun inserts a bot run
|
||||
// InsertRun inserts a run
|
||||
func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWorkflow) error {
|
||||
ctx, commiter, err := db.TxContext(ctx)
|
||||
if err != nil {
|
||||
@@ -137,7 +137,7 @@ func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWork
|
||||
}
|
||||
defer commiter.Close()
|
||||
|
||||
index, err := db.GetNextResourceIndex(ctx, "bot_run_index", run.RepoID)
|
||||
index, err := db.GetNextResourceIndex(ctx, "action_run_index", run.RepoID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ func (runs RunList) LoadTriggerUser(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
for _, run := range runs {
|
||||
if run.TriggerUserID == user_model.BotUserID {
|
||||
run.TriggerUser = user_model.NewBotUser()
|
||||
if run.TriggerUserID == user_model.ActionsUserID {
|
||||
run.TriggerUser = user_model.NewActionsUser()
|
||||
} else {
|
||||
run.TriggerUser = users[run.TriggerUserID]
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ func FindRunners(ctx context.Context, opts FindRunnerOptions) (runners RunnerLis
|
||||
return runners, sess.Find(&runners)
|
||||
}
|
||||
|
||||
// GetRunnerByUUID returns a bot runner via uuid
|
||||
// GetRunnerByUUID returns a runner via uuid
|
||||
func GetRunnerByUUID(ctx context.Context, uuid string) (*ActionRunner, error) {
|
||||
var runner ActionRunner
|
||||
has, err := db.GetEngine(ctx).Where("uuid=?", uuid).Get(&runner)
|
||||
@@ -209,7 +209,7 @@ func GetRunnerByUUID(ctx context.Context, uuid string) (*ActionRunner, error) {
|
||||
return &runner, nil
|
||||
}
|
||||
|
||||
// GetRunnerByID returns a bot runner via id
|
||||
// GetRunnerByID returns a runner via id
|
||||
func GetRunnerByID(ctx context.Context, id int64) (*ActionRunner, error) {
|
||||
var runner ActionRunner
|
||||
has, err := db.GetEngine(ctx).Where("id=?", id).Get(&runner)
|
||||
|
||||
@@ -33,7 +33,7 @@ func init() {
|
||||
db.RegisterModel(new(ActionRunnerToken))
|
||||
}
|
||||
|
||||
// GetRunnerToken returns a bot runner via token
|
||||
// GetRunnerToken returns a action runner via token
|
||||
func GetRunnerToken(ctx context.Context, token string) (*ActionRunnerToken, error) {
|
||||
var runnerToken ActionRunnerToken
|
||||
has, err := db.GetEngine(ctx).Where("token=?", token).Get(&runnerToken)
|
||||
|
||||
@@ -117,7 +117,7 @@ func (task *ActionTask) GetBuildViewLink() string {
|
||||
if task.Job == nil || task.Job.Run == nil || task.Job.Run.Repo == nil {
|
||||
return ""
|
||||
}
|
||||
return task.Job.Run.Repo.Link() + "/bots/runs/" + strconv.FormatInt(task.ID, 10)
|
||||
return task.Job.Run.Repo.Link() + "/actions/runs/" + strconv.FormatInt(task.ID, 10)
|
||||
}
|
||||
|
||||
func (task *ActionTask) GetCommitLink() string {
|
||||
@@ -265,7 +265,7 @@ func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask
|
||||
jobCond = builder.In("repo_id", builder.Select("id").From("repository").Where(builder.Eq{"owner_id": runner.OwnerID}))
|
||||
}
|
||||
if jobCond.IsValid() {
|
||||
jobCond = builder.In("run_id", builder.Select("id").From("bot_run").Where(jobCond))
|
||||
jobCond = builder.In("run_id", builder.Select("id").From("action_run").Where(jobCond))
|
||||
}
|
||||
|
||||
var jobs []*ActionRunJob
|
||||
|
||||
Reference in New Issue
Block a user