diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 1a18c62fb5..b5befe5f77 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -2479,8 +2479,8 @@ ROUTER = console ;; Comma separated list of host names requiring proxy. Glob patterns (*) are accepted; use ** to match all hosts. ;PROXY_HOSTS = -; [bots] -;; Enable/Disable bots capabilities +; [actions] +;; Enable/Disable actions capabilities ;ENABLED = false ;DEFAULT_BOTS_URL = https://gitea.com @@ -2488,7 +2488,7 @@ ROUTER = console ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; settings for packages, will override storage setting ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;[storage.bots_log] +;[storage.actions_log] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; storage type diff --git a/models/actions/run.go b/models/actions/run.go index ed2753148d..35ed3715f6 100644 --- a/models/actions/run.go +++ b/models/actions/run.go @@ -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 } diff --git a/models/actions/run_list.go b/models/actions/run_list.go index 759f987694..5e8facc7c1 100644 --- a/models/actions/run_list.go +++ b/models/actions/run_list.go @@ -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] } diff --git a/models/actions/runner.go b/models/actions/runner.go index cd955f1b5b..c6aa33138d 100644 --- a/models/actions/runner.go +++ b/models/actions/runner.go @@ -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) diff --git a/models/actions/runner_token.go b/models/actions/runner_token.go index 72e42b2d7b..fabd6c644c 100644 --- a/models/actions/runner_token.go +++ b/models/actions/runner_token.go @@ -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) diff --git a/models/actions/task.go b/models/actions/task.go index f4e49642cc..d7590407e7 100644 --- a/models/actions/task.go +++ b/models/actions/task.go @@ -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 diff --git a/models/issues/comment_list.go b/models/issues/comment_list.go index b2634da91b..f0baa98dce 100644 --- a/models/issues/comment_list.go +++ b/models/issues/comment_list.go @@ -35,8 +35,8 @@ func (comments CommentList) LoadPosters(ctx context.Context) error { } for _, comment := range comments { - if comment.PosterID == user_model.BotUserID { - comment.Poster = user_model.NewBotUser() + if comment.PosterID == user_model.ActionsUserID { + comment.Poster = user_model.NewActionsUser() } else if comment.PosterID <= 0 { continue } else { diff --git a/models/issues/issue_list.go b/models/issues/issue_list.go index 5d0f1758e3..a372143575 100644 --- a/models/issues/issue_list.go +++ b/models/issues/issue_list.go @@ -92,8 +92,8 @@ func (issues IssueList) loadPosters(ctx context.Context) error { } for _, issue := range issues { - if issue.PosterID == user_model.BotUserID { - issue.Poster = user_model.NewBotUser() + if issue.PosterID == user_model.ActionsUserID { + issue.Poster = user_model.NewActionsUser() } else if issue.PosterID <= 0 { continue } else { diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 807661466f..79a3cebbb4 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -444,7 +444,7 @@ var migrations = []Migration{ NewMigration("Add index for access_token", v1_19.AddIndexForAccessToken), // in dev - NewMigration("Add bots tables", addBotTables), + NewMigration("Add actions tables", addActionsTables), } // GetCurrentDBVersion returns the current db version diff --git a/models/migrations/v-dev.go b/models/migrations/v-dev.go index 809bf4d690..26065238c0 100644 --- a/models/migrations/v-dev.go +++ b/models/migrations/v-dev.go @@ -10,8 +10,8 @@ import ( "xorm.io/xorm" ) -func addBotTables(x *xorm.Engine) error { - type BotRunner struct { +func addActionsTables(x *xorm.Engine) error { + type ActionRunner struct { ID int64 UUID string `xorm:"CHAR(36) UNIQUE"` Name string `xorm:"VARCHAR(32)"` @@ -39,7 +39,7 @@ func addBotTables(x *xorm.Engine) error { Deleted timeutil.TimeStamp `xorm:"deleted"` } - type BotRunnerToken struct { + type ActionRunnerToken struct { ID int64 Token string `xorm:"UNIQUE"` OwnerID int64 `xorm:"index"` // org level runner, 0 means system @@ -51,7 +51,7 @@ func addBotTables(x *xorm.Engine) error { Deleted timeutil.TimeStamp `xorm:"deleted"` } - type BotRun struct { + type ActionRun struct { ID int64 Title string RepoID int64 `xorm:"index unique(repo_index)"` @@ -71,7 +71,7 @@ func addBotTables(x *xorm.Engine) error { Updated timeutil.TimeStamp `xorm:"updated"` } - type BotRunJob struct { + type ActionRunJob struct { ID int64 RunID int64 `xorm:"index"` RepoID int64 `xorm:"index"` @@ -97,9 +97,9 @@ func addBotTables(x *xorm.Engine) error { NumClosedRuns int `xorm:"NOT NULL DEFAULT 0"` } - type BotRunIndex db.ResourceIndex + type ActionRunIndex db.ResourceIndex - type BotTask struct { + type ActionTask struct { ID int64 JobID int64 Attempt int64 @@ -128,7 +128,7 @@ func addBotTables(x *xorm.Engine) error { Updated timeutil.TimeStamp `xorm:"updated index"` } - type BotTaskStep struct { + type ActionTaskStep struct { ID int64 Name string TaskID int64 `xorm:"index unique(task_number)"` @@ -162,14 +162,14 @@ func addBotTables(x *xorm.Engine) error { } return x.Sync( - new(BotRunner), - new(BotRunnerToken), - new(BotRun), - new(BotRunJob), + new(ActionRunner), + new(ActionRunnerToken), + new(ActionRun), + new(ActionRunJob), new(Repository), - new(BotRunIndex), - new(BotTask), - new(BotTaskStep), + new(ActionRunIndex), + new(ActionTask), + new(ActionTaskStep), new(dbfsMeta), new(dbfsData), ) diff --git a/models/repo/repo_unit.go b/models/repo/repo_unit.go index 236d5596ca..ee450a46c4 100644 --- a/models/repo/repo_unit.go +++ b/models/repo/repo_unit.go @@ -174,7 +174,7 @@ func (r *RepoUnit) BeforeSet(colName string, val xorm.Cell) { r.Config = new(PullRequestsConfig) case unit.TypeIssues: r.Config = new(IssuesConfig) - case unit.TypeCode, unit.TypeReleases, unit.TypeWiki, unit.TypeProjects, unit.TypePackages, unit.TypeBots: + case unit.TypeCode, unit.TypeReleases, unit.TypeWiki, unit.TypeProjects, unit.TypePackages, unit.TypeActions: fallthrough default: r.Config = new(UnitConfig) diff --git a/models/unit/unit.go b/models/unit/unit.go index e34b80570c..72ef0cc398 100644 --- a/models/unit/unit.go +++ b/models/unit/unit.go @@ -27,7 +27,7 @@ const ( TypeExternalTracker // 7 ExternalTracker TypeProjects // 8 Kanban board TypePackages // 9 Packages - TypeBots // 10 Bots + TypeActions // 10 Actions ) // Value returns integer value for unit type @@ -55,8 +55,8 @@ func (u Type) String() string { return "TypeProjects" case TypePackages: return "TypePackages" - case TypeBots: - return "TypeBots" + case TypeActions: + return "TypeActions" } return fmt.Sprintf("Unknown Type %d", u) } @@ -80,7 +80,7 @@ var ( TypeExternalTracker, TypeProjects, TypePackages, - TypeBots, + TypeActions, } // DefaultRepoUnits contains the default unit types @@ -292,11 +292,11 @@ var ( perm.AccessModeRead, } - UnitBots = Unit{ - TypeBots, - "repo.bots", - "/bots", - "repo.bots.desc", + UnitActions = Unit{ + TypeActions, + "repo.actions", + "/actions", + "repo.actions.desc", 7, perm.AccessModeOwner, } @@ -312,7 +312,7 @@ var ( TypeExternalWiki: UnitExternalWiki, TypeProjects: UnitProjects, TypePackages: UnitPackages, - TypeBots: UnitBots, + TypeActions: UnitActions, } ) diff --git a/models/unittest/testdb.go b/models/unittest/testdb.go index 42d34735d7..7629b0d916 100644 --- a/models/unittest/testdb.go +++ b/models/unittest/testdb.go @@ -104,7 +104,7 @@ func MainTest(m *testing.M, testOpts *TestOptions) { setting.Packages.Storage.Path = filepath.Join(setting.AppDataPath, "packages") - setting.Bots.Storage.Path = filepath.Join(setting.AppDataPath, "bots_log") + setting.Actions.Storage.Path = filepath.Join(setting.AppDataPath, "actions_log") setting.Git.HomePath = filepath.Join(setting.AppDataPath, "home") diff --git a/models/user/user.go b/models/user/user.go index 419eead83b..456e195efb 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -983,8 +983,8 @@ func GetPossbileUserByID(ctx context.Context, id int64) (*User, error) { switch id { case -1: return NewGhostUser(), nil - case BotUserID: - return NewBotUser(), nil + case ActionsUserID: + return NewActionsUser(), nil case 0: return nil, ErrUserNotExist{} default: diff --git a/models/user/user_system.go b/models/user/user_system.go index 9e7efc7a20..312f908ec5 100644 --- a/models/user/user_system.go +++ b/models/user/user_system.go @@ -36,30 +36,30 @@ func NewReplaceUser(name string) *User { } const ( - BotUserID = -2 - BotUserName = "[robot]gitea-bots" + ActionsUserID = -2 + ActionsUserName = "[bot]gitea-actions" ) -// NewBotUser creates and returns a fake user for running the build. -func NewBotUser() *User { +// NewActionsUser creates and returns a fake user for running the actions. +func NewActionsUser() *User { return &User{ - ID: BotUserID, - Name: "[robot]gitea-bots", - LowerName: "[robot]gitea-bots", + ID: ActionsUserID, + Name: ActionsUserName, + LowerName: ActionsUserName, IsActive: true, - FullName: "Gitea Bots", + FullName: "Gitea Actions", Email: "teabot@gitea.io", KeepEmailPrivate: true, - LoginName: "[robot]gitea-bots", + LoginName: ActionsUserName, Type: UserTypeIndividual, AllowCreateOrganization: true, Visibility: structs.VisibleTypePublic, } } -func (u *User) IsBots() bool { +func (u *User) IsActions() bool { if u == nil { return false } - return u.ID == BotUserID && u.Name == BotUserName + return u.ID == ActionsUserID && u.Name == ActionsUserName } diff --git a/modules/actions/log.go b/modules/actions/log.go index cdfb67fb33..c15237c773 100644 --- a/modules/actions/log.go +++ b/modules/actions/log.go @@ -22,7 +22,7 @@ import ( const ( MaxLineSize = 64 * 1024 - DBFSPrefix = "bots_tasks/" + DBFSPrefix = "actions_tasks/" timeFormat = "2006-01-02T15:04:05.0000000Z07:00" defaultBufSize = 64 * 1024 @@ -103,7 +103,7 @@ func TransferLogs(ctx context.Context, filename string) (func(), error) { } defer f.Close() - if _, err := storage.Bots.Save(filename, f, -1); err != nil { + if _, err := storage.Actions.Save(filename, f, -1); err != nil { return nil, fmt.Errorf("storage save %q: %w", filename, err) } return remove, nil @@ -118,7 +118,7 @@ func RemoveLogs(ctx context.Context, inStorage bool, filename string) error { } return nil } - err := storage.Bots.Delete(filename) + err := storage.Actions.Delete(filename) if err != nil { return fmt.Errorf("storage delete %q: %w", filename, err) } @@ -134,7 +134,7 @@ func openLogs(ctx context.Context, inStorage bool, filename string) (io.ReadSeek } return f, nil } - f, err := storage.Bots.Open(filename) + f, err := storage.Actions.Open(filename) if err != nil { return nil, fmt.Errorf("storage open %q: %w", filename, err) } diff --git a/modules/context/context.go b/modules/context/context.go index 4e3047f495..e221fd4ced 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -799,7 +799,7 @@ func Contexter(ctx context.Context) func(next http.Handler) http.Handler { ctx.Data["EnableOpenIDSignIn"] = setting.Service.EnableOpenIDSignIn ctx.Data["DisableMigrations"] = setting.Repository.DisableMigrations ctx.Data["DisableStars"] = setting.Repository.DisableStars - ctx.Data["EnableBots"] = setting.Bots.Enabled + ctx.Data["EnableActions"] = setting.Actions.Enabled ctx.Data["ManifestData"] = setting.ManifestData @@ -807,7 +807,7 @@ func Contexter(ctx context.Context) func(next http.Handler) http.Handler { ctx.Data["UnitIssuesGlobalDisabled"] = unit.TypeIssues.UnitGlobalDisabled() ctx.Data["UnitPullsGlobalDisabled"] = unit.TypePullRequests.UnitGlobalDisabled() ctx.Data["UnitProjectsGlobalDisabled"] = unit.TypeProjects.UnitGlobalDisabled() - ctx.Data["UnitBotsGlobalDisabled"] = unit.TypeBots.UnitGlobalDisabled() + ctx.Data["UnitActionsGlobalDisabled"] = unit.TypeActions.UnitGlobalDisabled() ctx.Data["locale"] = locale ctx.Data["AllLangs"] = translation.AllLangs() diff --git a/modules/context/repo.go b/modules/context/repo.go index 352f736180..8c1c0244ad 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -1042,7 +1042,7 @@ func UnitTypes() func(ctx *Context) { ctx.Data["UnitTypeExternalTracker"] = unit_model.TypeExternalTracker ctx.Data["UnitTypeProjects"] = unit_model.TypeProjects ctx.Data["UnitTypePackages"] = unit_model.TypePackages - ctx.Data["UnitTypeBots"] = unit_model.TypeBots + ctx.Data["UnitTypeActions"] = unit_model.TypeActions } } diff --git a/modules/notification/actions/actions.go b/modules/notification/actions/actions.go index 0250a1c051..2439b60ce4 100644 --- a/modules/notification/actions/actions.go +++ b/modules/notification/actions/actions.go @@ -23,19 +23,19 @@ import ( api "code.gitea.io/gitea/modules/structs" ) -type botsNotifier struct { +type actionsNotifier struct { base.NullNotifier } -var _ base.Notifier = &botsNotifier{} +var _ base.Notifier = &actionsNotifier{} -// NewNotifier create a new botsNotifier notifier +// NewNotifier create a new actionsNotifier notifier func NewNotifier() base.Notifier { - return &botsNotifier{} + return &actionsNotifier{} } // NotifyNewIssue notifies issue created event -func (n *botsNotifier) NotifyNewIssue(ctx context.Context, issue *issues_model.Issue, _ []*user_model.User) { +func (n *actionsNotifier) NotifyNewIssue(ctx context.Context, issue *issues_model.Issue, _ []*user_model.User) { ctx = withMethod(ctx, "NotifyNewIssue") if err := issue.LoadRepo(ctx); err != nil { log.Error("issue.LoadRepo: %v", err) @@ -57,7 +57,7 @@ func (n *botsNotifier) NotifyNewIssue(ctx context.Context, issue *issues_model.I } // NotifyIssueChangeStatus notifies close or reopen issue to notifiers -func (n *botsNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, _ *issues_model.Comment, isClosed bool) { +func (n *actionsNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, _ *issues_model.Comment, isClosed bool) { ctx = withMethod(ctx, "NotifyIssueChangeStatus") mode, _ := access_model.AccessLevel(ctx, issue.Poster, issue.Repo) if issue.IsPull { @@ -100,7 +100,7 @@ func (n *botsNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_m Notify(ctx) } -func (n *botsNotifier) NotifyIssueChangeLabels(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, +func (n *actionsNotifier) NotifyIssueChangeLabels(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, _, _ []*issues_model.Label, ) { ctx = withMethod(ctx, "NotifyIssueChangeLabels") @@ -151,7 +151,7 @@ func (n *botsNotifier) NotifyIssueChangeLabels(ctx context.Context, doer *user_m } // NotifyCreateIssueComment notifies comment on an issue to notifiers -func (n *botsNotifier) NotifyCreateIssueComment(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, +func (n *actionsNotifier) NotifyCreateIssueComment(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, issue *issues_model.Issue, comment *issues_model.Comment, _ []*user_model.User, ) { ctx = withMethod(ctx, "NotifyCreateIssueComment") @@ -185,7 +185,7 @@ func (n *botsNotifier) NotifyCreateIssueComment(ctx context.Context, doer *user_ Notify(ctx) } -func (n *botsNotifier) NotifyNewPullRequest(ctx context.Context, pull *issues_model.PullRequest, _ []*user_model.User) { +func (n *actionsNotifier) NotifyNewPullRequest(ctx context.Context, pull *issues_model.PullRequest, _ []*user_model.User) { ctx = withMethod(ctx, "NotifyNewPullRequest") if err := pull.LoadIssue(ctx); err != nil { @@ -215,7 +215,7 @@ func (n *botsNotifier) NotifyNewPullRequest(ctx context.Context, pull *issues_mo Notify(ctx) } -func (n *botsNotifier) NotifyCreateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) { +func (n *actionsNotifier) NotifyCreateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) { ctx = withMethod(ctx, "NotifyCreateRepository") newNotifyInput(repo, doer, webhook.HookEventRepository).WithPayload(&api.RepositoryPayload{ @@ -226,7 +226,7 @@ func (n *botsNotifier) NotifyCreateRepository(ctx context.Context, doer, u *user }).Notify(ctx) } -func (n *botsNotifier) NotifyForkRepository(ctx context.Context, doer *user_model.User, oldRepo, repo *repo_model.Repository) { +func (n *actionsNotifier) NotifyForkRepository(ctx context.Context, doer *user_model.User, oldRepo, repo *repo_model.Repository) { ctx = withMethod(ctx, "NotifyForkRepository") oldMode, _ := access_model.AccessLevel(ctx, doer, oldRepo) @@ -254,7 +254,7 @@ func (n *botsNotifier) NotifyForkRepository(ctx context.Context, doer *user_mode } } -func (n *botsNotifier) NotifyPullRequestReview(ctx context.Context, pr *issues_model.PullRequest, review *issues_model.Review, _ *issues_model.Comment, _ []*user_model.User) { +func (n *actionsNotifier) NotifyPullRequestReview(ctx context.Context, pr *issues_model.PullRequest, review *issues_model.Review, _ *issues_model.Comment, _ []*user_model.User) { ctx = withMethod(ctx, "NotifyPullRequestReview") var reviewHookType webhook.HookEventType @@ -298,7 +298,7 @@ func (n *botsNotifier) NotifyPullRequestReview(ctx context.Context, pr *issues_m }).Notify(ctx) } -func (*botsNotifier) NotifyMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { +func (*actionsNotifier) NotifyMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { ctx = withMethod(ctx, "NotifyMergePullRequest") // Reload pull request information. @@ -339,7 +339,7 @@ func (*botsNotifier) NotifyMergePullRequest(ctx context.Context, doer *user_mode Notify(ctx) } -func (n *botsNotifier) NotifyPushCommits(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { +func (n *actionsNotifier) NotifyPushCommits(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { ctx = withMethod(ctx, "NotifyPushCommits") apiPusher := convert.ToUser(pusher, nil) @@ -365,7 +365,7 @@ func (n *botsNotifier) NotifyPushCommits(ctx context.Context, pusher *user_model Notify(ctx) } -func (n *botsNotifier) NotifyCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) { +func (n *actionsNotifier) NotifyCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) { ctx = withMethod(ctx, "NotifyCreateRef") apiPusher := convert.ToUser(pusher, nil) @@ -384,7 +384,7 @@ func (n *botsNotifier) NotifyCreateRef(ctx context.Context, pusher *user_model.U Notify(ctx) } -func (n *botsNotifier) NotifyDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) { +func (n *actionsNotifier) NotifyDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) { ctx = withMethod(ctx, "NotifyDeleteRef") apiPusher := convert.ToUser(pusher, nil) @@ -403,7 +403,7 @@ func (n *botsNotifier) NotifyDeleteRef(ctx context.Context, pusher *user_model.U Notify(ctx) } -func (n *botsNotifier) NotifySyncPushCommits(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { +func (n *actionsNotifier) NotifySyncPushCommits(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { ctx = withMethod(ctx, "NotifySyncPushCommits") apiPusher := convert.ToUser(pusher, nil) @@ -430,47 +430,47 @@ func (n *botsNotifier) NotifySyncPushCommits(ctx context.Context, pusher *user_m Notify(ctx) } -func (n *botsNotifier) NotifySyncCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) { +func (n *actionsNotifier) NotifySyncCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) { ctx = withMethod(ctx, "NotifySyncCreateRef") n.NotifyCreateRef(ctx, pusher, repo, refType, refFullName, refID) } -func (n *botsNotifier) NotifySyncDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) { +func (n *actionsNotifier) NotifySyncDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) { ctx = withMethod(ctx, "NotifySyncDeleteRef") n.NotifyDeleteRef(ctx, pusher, repo, refType, refFullName) } -func (n *botsNotifier) NotifyNewRelease(ctx context.Context, rel *repo_model.Release) { +func (n *actionsNotifier) NotifyNewRelease(ctx context.Context, rel *repo_model.Release) { ctx = withMethod(ctx, "NotifyNewRelease") notifyRelease(ctx, rel.Publisher, rel, rel.Sha1, api.HookReleasePublished) } -func (n *botsNotifier) NotifyUpdateRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) { +func (n *actionsNotifier) NotifyUpdateRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) { ctx = withMethod(ctx, "NotifyUpdateRelease") notifyRelease(ctx, doer, rel, rel.Sha1, api.HookReleaseUpdated) } -func (n *botsNotifier) NotifyDeleteRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) { +func (n *actionsNotifier) NotifyDeleteRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) { ctx = withMethod(ctx, "NotifyDeleteRelease") notifyRelease(ctx, doer, rel, rel.Sha1, api.HookReleaseDeleted) } -func (n *botsNotifier) NotifyPackageCreate(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) { +func (n *actionsNotifier) NotifyPackageCreate(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) { ctx = withMethod(ctx, "NotifyPackageCreate") notifyPackage(ctx, doer, pd, api.HookPackageCreated) } -func (n *botsNotifier) NotifyPackageDelete(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) { +func (n *actionsNotifier) NotifyPackageDelete(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) { ctx = withMethod(ctx, "NotifyPackageDelete") notifyPackage(ctx, doer, pd, api.HookPackageDeleted) } -func (n *botsNotifier) NotifyAutoMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { +func (n *actionsNotifier) NotifyAutoMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { ctx = withMethod(ctx, "NotifyAutoMergePullRequest") n.NotifyMergePullRequest(ctx, doer, pr) } -func (n *botsNotifier) NotifyPullRequestSynchronized(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { +func (n *actionsNotifier) NotifyPullRequestSynchronized(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { ctx = withMethod(ctx, "NotifyPullRequestSynchronized") if err := pr.LoadIssue(ctx); err != nil { @@ -495,7 +495,7 @@ func (n *botsNotifier) NotifyPullRequestSynchronized(ctx context.Context, doer * Notify(ctx) } -func (n *botsNotifier) NotifyPullRequestChangeTargetBranch(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest, oldBranch string) { +func (n *actionsNotifier) NotifyPullRequestChangeTargetBranch(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest, oldBranch string) { ctx = withMethod(ctx, "NotifyPullRequestChangeTargetBranch") if err := pr.LoadIssue(ctx); err != nil { diff --git a/modules/notification/actions/helper.go b/modules/notification/actions/helper.go index 84bf960ff1..fe32106e4c 100644 --- a/modules/notification/actions/helper.go +++ b/modules/notification/actions/helper.go @@ -16,7 +16,7 @@ import ( "code.gitea.io/gitea/models/unit" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/models/webhook" - bots_module "code.gitea.io/gitea/modules/actions" + actions_module "code.gitea.io/gitea/modules/actions" "code.gitea.io/gitea/modules/convert" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/json" @@ -96,12 +96,12 @@ func (input *notifyInput) Notify(ctx context.Context) { } func notify(ctx context.Context, input *notifyInput) error { - if unit.TypeBots.UnitGlobalDisabled() { + if unit.TypeActions.UnitGlobalDisabled() { return nil } if err := input.Repo.LoadUnits(db.DefaultContext); err != nil { return fmt.Errorf("repo.LoadUnits: %w", err) - } else if !input.Repo.UnitEnabled(unit.TypeBots) { + } else if !input.Repo.UnitEnabled(unit.TypeActions) { return nil } @@ -117,7 +117,7 @@ func notify(ctx context.Context, input *notifyInput) error { return fmt.Errorf("gitRepo.GetCommit: %v", err) } - workflows, err := bots_module.DetectWorkflows(commit, input.Event) + workflows, err := actions_module.DetectWorkflows(commit, input.Event) if err != nil { return fmt.Errorf("DetectWorkflows: %v", err) } diff --git a/modules/notification/notification.go b/modules/notification/notification.go index 109f08974e..cc90caf8c3 100644 --- a/modules/notification/notification.go +++ b/modules/notification/notification.go @@ -41,14 +41,14 @@ func NewContext() { RegisterNotifier(webhook.NewNotifier()) RegisterNotifier(action.NewNotifier()) RegisterNotifier(mirror.NewNotifier()) - if setting.Bots.Enabled { + if setting.Actions.Enabled { RegisterNotifier(actions.NewNotifier()) } } // NotifyNewWikiPage notifies creating new wiki pages to notifiers func NotifyNewWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page, comment string) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -58,7 +58,7 @@ func NotifyNewWikiPage(ctx context.Context, doer *user_model.User, repo *repo_mo // NotifyEditWikiPage notifies editing or renaming wiki pages to notifiers func NotifyEditWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page, comment string) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -68,7 +68,7 @@ func NotifyEditWikiPage(ctx context.Context, doer *user_model.User, repo *repo_m // NotifyDeleteWikiPage notifies deleting wiki pages to notifiers func NotifyDeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page string) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -80,7 +80,7 @@ func NotifyDeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo func NotifyCreateIssueComment(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, issue *issues_model.Issue, comment *issues_model.Comment, mentions []*user_model.User, ) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -90,7 +90,7 @@ func NotifyCreateIssueComment(ctx context.Context, doer *user_model.User, repo * // NotifyNewIssue notifies new issue to notifiers func NotifyNewIssue(ctx context.Context, issue *issues_model.Issue, mentions []*user_model.User) { - if issue.Poster.IsBots() { + if issue.Poster.IsActions() { return } for _, notifier := range notifiers { @@ -100,7 +100,7 @@ func NotifyNewIssue(ctx context.Context, issue *issues_model.Issue, mentions []* // NotifyIssueChangeStatus notifies close or reopen issue to notifiers func NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -110,7 +110,7 @@ func NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue * // NotifyDeleteIssue notify when some issue deleted func NotifyDeleteIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Issue) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -120,7 +120,7 @@ func NotifyDeleteIssue(ctx context.Context, doer *user_model.User, issue *issues // NotifyMergePullRequest notifies merge pull request to notifiers func NotifyMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -130,7 +130,7 @@ func NotifyMergePullRequest(ctx context.Context, doer *user_model.User, pr *issu // NotifyAutoMergePullRequest notifies merge pull request to notifiers func NotifyAutoMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -147,7 +147,7 @@ func NotifyNewPullRequest(ctx context.Context, pr *issues_model.PullRequest, men if err := pr.Issue.LoadPoster(ctx); err != nil { return } - if pr.Issue.Poster.IsBots() { + if pr.Issue.Poster.IsActions() { return } for _, notifier := range notifiers { @@ -157,7 +157,7 @@ func NotifyNewPullRequest(ctx context.Context, pr *issues_model.PullRequest, men // NotifyPullRequestSynchronized notifies Synchronized pull request func NotifyPullRequestSynchronized(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -171,7 +171,7 @@ func NotifyPullRequestReview(ctx context.Context, pr *issues_model.PullRequest, log.Error("%v", err) return } - if review.Reviewer.IsBots() { + if review.Reviewer.IsActions() { return } for _, notifier := range notifiers { @@ -185,7 +185,7 @@ func NotifyPullRequestCodeComment(ctx context.Context, pr *issues_model.PullRequ log.Error("LoadPoster: %v", err) return } - if comment.Poster.IsBots() { + if comment.Poster.IsActions() { return } for _, notifier := range notifiers { @@ -195,7 +195,7 @@ func NotifyPullRequestCodeComment(ctx context.Context, pr *issues_model.PullRequ // NotifyPullRequestChangeTargetBranch notifies when a pull request's target branch was changed func NotifyPullRequestChangeTargetBranch(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest, oldBranch string) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -205,7 +205,7 @@ func NotifyPullRequestChangeTargetBranch(ctx context.Context, doer *user_model.U // NotifyPullRequestPushCommits notifies when push commits to pull request's head branch func NotifyPullRequestPushCommits(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest, comment *issues_model.Comment) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -215,7 +215,7 @@ func NotifyPullRequestPushCommits(ctx context.Context, doer *user_model.User, pr // NotifyPullReviewDismiss notifies when a review was dismissed by repo admin func NotifyPullReviewDismiss(ctx context.Context, doer *user_model.User, review *issues_model.Review, comment *issues_model.Comment) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -225,7 +225,7 @@ func NotifyPullReviewDismiss(ctx context.Context, doer *user_model.User, review // NotifyUpdateComment notifies update comment to notifiers func NotifyUpdateComment(ctx context.Context, doer *user_model.User, c *issues_model.Comment, oldContent string) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -235,7 +235,7 @@ func NotifyUpdateComment(ctx context.Context, doer *user_model.User, c *issues_m // NotifyDeleteComment notifies delete comment to notifiers func NotifyDeleteComment(ctx context.Context, doer *user_model.User, c *issues_model.Comment) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -249,7 +249,7 @@ func NotifyNewRelease(ctx context.Context, rel *repo_model.Release) { log.Error("LoadPublisher: %v", err) return } - if rel.Publisher.IsBots() { + if rel.Publisher.IsActions() { return } for _, notifier := range notifiers { @@ -259,7 +259,7 @@ func NotifyNewRelease(ctx context.Context, rel *repo_model.Release) { // NotifyUpdateRelease notifies update release to notifiers func NotifyUpdateRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -269,7 +269,7 @@ func NotifyUpdateRelease(ctx context.Context, doer *user_model.User, rel *repo_m // NotifyDeleteRelease notifies delete release to notifiers func NotifyDeleteRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -279,7 +279,7 @@ func NotifyDeleteRelease(ctx context.Context, doer *user_model.User, rel *repo_m // NotifyIssueChangeMilestone notifies change milestone to notifiers func NotifyIssueChangeMilestone(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldMilestoneID int64) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -289,7 +289,7 @@ func NotifyIssueChangeMilestone(ctx context.Context, doer *user_model.User, issu // NotifyIssueChangeContent notifies change content to notifiers func NotifyIssueChangeContent(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldContent string) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -299,7 +299,7 @@ func NotifyIssueChangeContent(ctx context.Context, doer *user_model.User, issue // NotifyIssueChangeAssignee notifies change content to notifiers func NotifyIssueChangeAssignee(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, assignee *user_model.User, removed bool, comment *issues_model.Comment) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -309,7 +309,7 @@ func NotifyIssueChangeAssignee(ctx context.Context, doer *user_model.User, issue // NotifyPullReviewRequest notifies Request Review change func NotifyPullReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -319,7 +319,7 @@ func NotifyPullReviewRequest(ctx context.Context, doer *user_model.User, issue * // NotifyIssueClearLabels notifies clear labels to notifiers func NotifyIssueClearLabels(ctx context.Context, doer *user_model.User, issue *issues_model.Issue) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -329,7 +329,7 @@ func NotifyIssueClearLabels(ctx context.Context, doer *user_model.User, issue *i // NotifyIssueChangeTitle notifies change title to notifiers func NotifyIssueChangeTitle(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldTitle string) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -339,7 +339,7 @@ func NotifyIssueChangeTitle(ctx context.Context, doer *user_model.User, issue *i // NotifyIssueChangeRef notifies change reference to notifiers func NotifyIssueChangeRef(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldRef string) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -351,7 +351,7 @@ func NotifyIssueChangeRef(ctx context.Context, doer *user_model.User, issue *iss func NotifyIssueChangeLabels(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, addedLabels, removedLabels []*issues_model.Label, ) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -361,7 +361,7 @@ func NotifyIssueChangeLabels(ctx context.Context, doer *user_model.User, issue * // NotifyCreateRepository notifies create repository to notifiers func NotifyCreateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -371,7 +371,7 @@ func NotifyCreateRepository(ctx context.Context, doer, u *user_model.User, repo // NotifyMigrateRepository notifies create repository to notifiers func NotifyMigrateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -381,7 +381,7 @@ func NotifyMigrateRepository(ctx context.Context, doer, u *user_model.User, repo // NotifyTransferRepository notifies create repository to notifiers func NotifyTransferRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, newOwnerName string) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -391,7 +391,7 @@ func NotifyTransferRepository(ctx context.Context, doer *user_model.User, repo * // NotifyDeleteRepository notifies delete repository to notifiers func NotifyDeleteRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -401,7 +401,7 @@ func NotifyDeleteRepository(ctx context.Context, doer *user_model.User, repo *re // NotifyForkRepository notifies fork repository to notifiers func NotifyForkRepository(ctx context.Context, doer *user_model.User, oldRepo, repo *repo_model.Repository) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -411,7 +411,7 @@ func NotifyForkRepository(ctx context.Context, doer *user_model.User, oldRepo, r // NotifyRenameRepository notifies repository renamed func NotifyRenameRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, oldName string) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -421,7 +421,7 @@ func NotifyRenameRepository(ctx context.Context, doer *user_model.User, repo *re // NotifyPushCommits notifies commits pushed to notifiers func NotifyPushCommits(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { - if pusher.IsBots() { + if pusher.IsActions() { return } for _, notifier := range notifiers { @@ -431,7 +431,7 @@ func NotifyPushCommits(ctx context.Context, pusher *user_model.User, repo *repo_ // NotifyCreateRef notifies branch or tag creation to notifiers func NotifyCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) { - if pusher.IsBots() { + if pusher.IsActions() { return } for _, notifier := range notifiers { @@ -441,7 +441,7 @@ func NotifyCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_mo // NotifyDeleteRef notifies branch or tag deletion to notifiers func NotifyDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) { - if pusher.IsBots() { + if pusher.IsActions() { return } for _, notifier := range notifiers { @@ -451,7 +451,7 @@ func NotifyDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_mo // NotifySyncPushCommits notifies commits pushed to notifiers func NotifySyncPushCommits(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { - if pusher.IsBots() { + if pusher.IsActions() { return } for _, notifier := range notifiers { @@ -461,7 +461,7 @@ func NotifySyncPushCommits(ctx context.Context, pusher *user_model.User, repo *r // NotifySyncCreateRef notifies branch or tag creation to notifiers func NotifySyncCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) { - if pusher.IsBots() { + if pusher.IsActions() { return } for _, notifier := range notifiers { @@ -471,7 +471,7 @@ func NotifySyncCreateRef(ctx context.Context, pusher *user_model.User, repo *rep // NotifySyncDeleteRef notifies branch or tag deletion to notifiers func NotifySyncDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) { - if pusher.IsBots() { + if pusher.IsActions() { return } for _, notifier := range notifiers { @@ -481,7 +481,7 @@ func NotifySyncDeleteRef(ctx context.Context, pusher *user_model.User, repo *rep // NotifyRepoPendingTransfer notifies creation of pending transfer to notifiers func NotifyRepoPendingTransfer(ctx context.Context, doer, newOwner *user_model.User, repo *repo_model.Repository) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -491,7 +491,7 @@ func NotifyRepoPendingTransfer(ctx context.Context, doer, newOwner *user_model.U // NotifyPackageCreate notifies creation of a package to notifiers func NotifyPackageCreate(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { @@ -501,7 +501,7 @@ func NotifyPackageCreate(ctx context.Context, doer *user_model.User, pd *package // NotifyPackageDelete notifies deletion of a package to notifiers func NotifyPackageDelete(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) { - if doer.IsBots() { + if doer.IsActions() { return } for _, notifier := range notifiers { diff --git a/modules/setting/actions.go b/modules/setting/actions.go index a094a3aeda..5f28cf49df 100644 --- a/modules/setting/actions.go +++ b/modules/setting/actions.go @@ -7,23 +7,23 @@ import ( "code.gitea.io/gitea/modules/log" ) -// Bots settings +// Actions settings var ( - Bots = struct { + Actions = struct { Storage - Enabled bool - DefaultBotsURL string + Enabled bool + DefaultActionsURL string }{ - Enabled: false, - DefaultBotsURL: "https://gitea.com", + Enabled: false, + DefaultActionsURL: "https://gitea.com", } ) -func newBots() { - sec := Cfg.Section("bots") - if err := sec.MapTo(&Bots); err != nil { - log.Fatal("Failed to map Bots settings: %v", err) +func newActions() { + sec := Cfg.Section("actions") + if err := sec.MapTo(&Actions); err != nil { + log.Fatal("Failed to map Actions settings: %v", err) } - Bots.Storage = getStorage("bots_log", "", nil) + Actions.Storage = getStorage("actions_log", "", nil) } diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 1f7c8ffaa5..daac8ca43e 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -1081,7 +1081,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) { newPackages() - newBots() + newActions() if err = Cfg.Section("ui").MapTo(&UI); err != nil { log.Fatal("Failed to map UI settings: %v", err) diff --git a/modules/storage/storage.go b/modules/storage/storage.go index ebcbd68395..d8998b1922 100644 --- a/modules/storage/storage.go +++ b/modules/storage/storage.go @@ -126,8 +126,8 @@ var ( // Packages represents packages storage Packages ObjectStorage = uninitializedStorage - // Bots represents bots storage - Bots ObjectStorage = uninitializedStorage + // Actions represents actions storage + Actions ObjectStorage = uninitializedStorage ) // Init init the stoarge @@ -139,7 +139,7 @@ func Init() error { initLFS, initRepoArchives, initPackages, - initBots, + initActions, } { if err := f(); err != nil { return err @@ -209,12 +209,12 @@ func initPackages() (err error) { return err } -func initBots() (err error) { - if !setting.Bots.Enabled { - Bots = discardStorage("Bots isn't enabled") +func initActions() (err error) { + if !setting.Actions.Enabled { + Actions = discardStorage("Actions isn't enabled") return nil } - log.Info("Initialising Bots storage with type: %s", setting.Bots.Storage.Type) - Bots, err = NewStorage(setting.Bots.Storage.Type, &setting.Bots.Storage) + log.Info("Initialising Actions storage with type: %s", setting.Actions.Storage.Type) + Actions, err = NewStorage(setting.Actions.Storage.Type, &setting.Actions.Storage) return err } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 1e6caf8fb0..cd4b17a1cf 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1228,11 +1228,11 @@ projects.open = Open projects.close = Close projects.board.assigned_to = Assigned to -bots = Bots -bots.desc = Manage bots -bots.opened_by = opened %[1]s by %[2]s -bots.open_tab = %d Open -bots.closed_tab = %d Closed +actions = Actions +actions.desc = Manage actions +actions.opened_by = opened %[1]s by %[2]s +actions.open_tab = %d Open +actions.closed_tab = %d Closed issues.desc = Organize bug reports, tasks and milestones. issues.filter_assignees = Filter Assignee diff --git a/routers/api/actions/runner/runner.go b/routers/api/actions/runner/runner.go index fbe102fba1..418b534bd3 100644 --- a/routers/api/actions/runner/runner.go +++ b/routers/api/actions/runner/runner.go @@ -331,7 +331,7 @@ func generateTaskContext(t *actions_model.ActionTask) *structpb.Struct { "workspace": "", // string, The default working directory on the runner for steps, and the default location of your repository when using the checkout action. // additional contexts - "gitea_default_bots_url": setting.Bots.DefaultBotsURL, + "gitea_default_actions_url": setting.Actions.DefaultActionsURL, }) return taskContext diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 7e9fa9bd29..e209de157e 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -185,9 +185,9 @@ func repoAssignment() func(ctx *context.APIContext) { repo.Owner = owner ctx.Repo.Repository = repo - if ctx.Doer != nil && ctx.Doer.ID == user_model.BotUserID { - botTaskID := ctx.Data["BotTaskID"].(int64) - task, err := actions_model.GetTaskByID(ctx, botTaskID) + if ctx.Doer != nil && ctx.Doer.ID == user_model.ActionsUserID { + taskID := ctx.Data["ActionsTaskID"].(int64) + task, err := actions_model.GetTaskByID(ctx, taskID) if err != nil { ctx.Error(http.StatusInternalServerError, "actions_model.GetTaskByID", err) return @@ -239,7 +239,7 @@ func reqPackageAccess(accessMode perm.AccessMode) func(ctx *context.APIContext) // Contexter middleware already checks token for user sign in process. func reqToken() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { - if true == ctx.Data["IsApiToken"] || true == ctx.Data["IsBotToken"] { + if true == ctx.Data["IsApiToken"] || true == ctx.Data["IsActionsToken"] { return } if ctx.Context.IsBasicAuth { diff --git a/routers/init.go b/routers/init.go index 24c2c11ff2..a5a6a31600 100644 --- a/routers/init.go +++ b/routers/init.go @@ -202,8 +202,8 @@ func NormalRoutes(ctx context.Context) *web.Route { r.Mount("/v2", packages_router.ContainerRoutes(ctx)) } - if setting.Bots.Enabled { - prefix := "/api/bots" + if setting.Actions.Enabled { + prefix := "/api/actions" r.Mount(prefix, actions_router.Routes(ctx, prefix)) } diff --git a/routers/private/hook_pre_receive.go b/routers/private/hook_pre_receive.go index 36701d4536..3faf307dff 100644 --- a/routers/private/hook_pre_receive.go +++ b/routers/private/hook_pre_receive.go @@ -464,8 +464,8 @@ func (ctx *preReceiveContext) loadPusherAndPermission() bool { return true } - if ctx.opts.UserID == user_model.BotUserID { - ctx.user = user_model.NewBotUser() + if ctx.opts.UserID == user_model.ActionsUserID { + ctx.user = user_model.NewActionsUser() ctx.userPerm.AccessMode = perm_model.AccessModeAdmin if err := ctx.Repo.Repository.LoadUnits(ctx); err != nil { log.Error("Unable to get User id %d Error: %v", ctx.opts.UserID, err) diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go index ab8e693efc..72f5759ffc 100644 --- a/routers/web/repo/actions/actions.go +++ b/routers/web/repo/actions/actions.go @@ -18,33 +18,33 @@ import ( ) const ( - tplListBots base.TplName = "repo/bots/list" - tplViewBuild base.TplName = "repo/bots/view" + tplListActions base.TplName = "repo/actions/list" + tplViewActions base.TplName = "repo/actions/view" ) -// MustEnableBots check if bots are enabled in settings -func MustEnableBots(ctx *context.Context) { - if !setting.Bots.Enabled { - ctx.NotFound("MustEnableBots", nil) +// MustEnableActions check if actions are enabled in settings +func MustEnableActions(ctx *context.Context) { + if !setting.Actions.Enabled { + ctx.NotFound("MustEnableActions", nil) return } - if unit.TypeBots.UnitGlobalDisabled() { - ctx.NotFound("MustEnableBots", nil) + if unit.TypeActions.UnitGlobalDisabled() { + ctx.NotFound("MustEnableActions", nil) return } if ctx.Repo.Repository != nil { - if !ctx.Repo.CanRead(unit.TypeBots) { - ctx.NotFound("MustEnableBots", nil) + if !ctx.Repo.CanRead(unit.TypeActions) { + ctx.NotFound("MustEnableActions", nil) return } } } func List(ctx *context.Context) { - ctx.Data["Title"] = ctx.Tr("repo.bots") - ctx.Data["PageIsBots"] = true + ctx.Data["Title"] = ctx.Tr("repo.actions") + ctx.Data["PageIsActions"] = true defaultBranch, err := ctx.Repo.GitRepo.GetDefaultBranch() if err != nil { @@ -129,5 +129,5 @@ func List(ctx *context.Context) { pager.SetDefaultParams(ctx) ctx.Data["Page"] = pager - ctx.HTML(http.StatusOK, tplListBots) + ctx.HTML(http.StatusOK, tplListActions) } diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index 756409f52f..644cbd9cc3 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -24,7 +24,7 @@ import ( ) func View(ctx *context_module.Context) { - ctx.Data["PageIsBots"] = true + ctx.Data["PageIsActions"] = true runIndex := ctx.ParamsInt64("run") jobIndex := ctx.ParamsInt64("job") ctx.Data["RunIndex"] = runIndex @@ -37,7 +37,7 @@ func View(ctx *context_module.Context) { run := job.Run ctx.Data["Build"] = run - ctx.HTML(http.StatusOK, tplViewBuild) + ctx.HTML(http.StatusOK, tplViewActions) } type ViewRequest struct { diff --git a/routers/web/repo/http.go b/routers/web/repo/http.go index a0b33e8749..a07f3ed0b6 100644 --- a/routers/web/repo/http.go +++ b/routers/web/repo/http.go @@ -164,7 +164,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { return } - if ctx.IsBasicAuth && ctx.Data["IsApiToken"] != true && ctx.Data["IsBotToken"] != true { + if ctx.IsBasicAuth && ctx.Data["IsApiToken"] != true && ctx.Data["IsActionsToken"] != true { _, err = auth.GetTwoFactorByUID(ctx.Doer.ID) if err == nil { // TODO: This response should be changed to "invalid credentials" for security reasons once the expectation behind it (creating an app token to authenticate) is properly documented @@ -187,8 +187,8 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { accessMode = perm.AccessModeRead } - if ctx.Data["IsBotToken"] == true { - taskID := ctx.Data["BotTaskID"].(int64) + if ctx.Data["IsActionsToken"] == true { + taskID := ctx.Data["ActionsTaskID"].(int64) task, err := actions_model.GetTaskByID(ctx, taskID) if err != nil { ctx.ServerError("GetTaskByID", err) diff --git a/routers/web/repo/setting.go b/routers/web/repo/setting.go index 574b117a26..5b1e5f58ca 100644 --- a/routers/web/repo/setting.go +++ b/routers/web/repo/setting.go @@ -489,13 +489,13 @@ func SettingsPost(ctx *context.Context) { deleteUnitTypes = append(deleteUnitTypes, unit_model.TypePackages) } - if form.EnableBots && !unit_model.TypeBots.UnitGlobalDisabled() { + if form.EnableActions && !unit_model.TypeActions.UnitGlobalDisabled() { units = append(units, repo_model.RepoUnit{ RepoID: repo.ID, - Type: unit_model.TypeBots, + Type: unit_model.TypeActions, }) - } else if !unit_model.TypeBots.UnitGlobalDisabled() { - deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeBots) + } else if !unit_model.TypeActions.UnitGlobalDisabled() { + deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeActions) } if form.EnablePulls && !unit_model.TypePullRequests.UnitGlobalDisabled() { diff --git a/routers/web/web.go b/routers/web/web.go index 8f24868b8b..9df223c29f 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -629,7 +629,7 @@ func RegisterRoutes(m *web.Route) { m.Get("/reset_registration_token", admin.ResetRunnerRegistrationToken) m.Combo("/{runnerid}").Get(admin.EditRunner).Post(bindIgnErr(forms.EditRunnerForm{}), admin.EditRunnerPost) m.Post("/{runnerid}/delete", admin.DeleteRunnerPost) - }, actions.MustEnableBots) + }, actions.MustEnableActions) }, func(ctx *context.Context) { ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable ctx.Data["EnablePackages"] = setting.Packages.Enabled @@ -672,7 +672,7 @@ func RegisterRoutes(m *web.Route) { reqRepoIssuesOrPullsReader := context.RequireRepoReaderOr(unit.TypeIssues, unit.TypePullRequests) reqRepoProjectsReader := context.RequireRepoReader(unit.TypeProjects) reqRepoProjectsWriter := context.RequireRepoWriter(unit.TypeProjects) - reqRepoBotsReader := context.RequireRepoReader(unit.TypeBots) + reqRepoActionsReader := context.RequireRepoReader(unit.TypeActions) reqPackageAccess := func(accessMode perm.AccessMode) func(ctx *context.Context) { return func(ctx *context.Context) { @@ -792,7 +792,7 @@ func RegisterRoutes(m *web.Route) { Post(bindIgnErr(forms.EditRunnerForm{}), org.RunnersEditPost) m.Post("/{runnerid}/delete", org.RunnerDeletePost) m.Get("/reset_registration_token", org.ResetRunnerRegistrationToken) - }, actions.MustEnableBots) + }, actions.MustEnableActions) m.Group("/secrets", func() { m.Get("", org.Secrets) @@ -960,7 +960,7 @@ func RegisterRoutes(m *web.Route) { Post(bindIgnErr(forms.EditRunnerForm{}), repo.RunnersEditPost) m.Post("/{runnerid}/delete", repo.RunnerDeletePost) m.Get("/reset_registration_token", repo.ResetRunnerRegistrationToken) - }, actions.MustEnableBots) + }, actions.MustEnableActions) }, func(ctx *context.Context) { ctx.Data["PageIsSettings"] = true ctx.Data["LFSStartServer"] = setting.LFS.StartServer @@ -1199,7 +1199,7 @@ func RegisterRoutes(m *web.Route) { }, reqRepoProjectsWriter, context.RepoMustNotBeArchived()) }, reqRepoProjectsReader, repo.MustEnableProjects) - m.Group("/bots", func() { + m.Group("/actions", func() { m.Get("", actions.List) m.Group("/runs/{run}", func() { @@ -1214,7 +1214,7 @@ func RegisterRoutes(m *web.Route) { }) m.Post("/cancel", actions.Cancel) }) - }, reqRepoBotsReader, actions.MustEnableBots) + }, reqRepoActionsReader, actions.MustEnableActions) m.Group("/wiki", func() { m.Combo("/"). diff --git a/services/actions/actions.go b/services/actions/actions.go index d55e329ebd..c62d8608ce 100644 --- a/services/actions/actions.go +++ b/services/actions/actions.go @@ -13,7 +13,7 @@ import ( repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/models/webhook" - bots_module "code.gitea.io/gitea/modules/actions" + actions_module "code.gitea.io/gitea/modules/actions" "code.gitea.io/gitea/modules/graceful" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/queue" @@ -21,7 +21,7 @@ import ( ) func Init() { - jobEmitterQueue = queue.CreateUniqueQueue("bots_ready_job", jobEmitterQueueHandle, new(jobUpdate)) + jobEmitterQueue = queue.CreateUniqueQueue("actions_ready_job", jobEmitterQueueHandle, new(jobUpdate)) go graceful.GetManager().RunWithShutdownFns(jobEmitterQueue.Run) } @@ -34,19 +34,19 @@ func DeleteResourceOfRepository(ctx context.Context, repo *repo_model.Repository if err := db.WithTx(ctx, func(ctx context.Context) error { e := db.GetEngine(ctx) if _, err := e.Delete(&actions_model.ActionTaskStep{RepoID: repo.ID}); err != nil { - return fmt.Errorf("delete bots task steps of repo %d: %w", repo.ID, err) + return fmt.Errorf("delete actions task steps of repo %d: %w", repo.ID, err) } if _, err := e.Delete(&actions_model.ActionTask{RepoID: repo.ID}); err != nil { - return fmt.Errorf("delete bots tasks of repo %d: %w", repo.ID, err) + return fmt.Errorf("delete actions tasks of repo %d: %w", repo.ID, err) } if _, err := e.Delete(&actions_model.ActionRunJob{RepoID: repo.ID}); err != nil { - return fmt.Errorf("delete bots run jobs of repo %d: %w", repo.ID, err) + return fmt.Errorf("delete actions run jobs of repo %d: %w", repo.ID, err) } if _, err := e.Delete(&actions_model.ActionRun{RepoID: repo.ID}); err != nil { - return fmt.Errorf("delete bots runs of repo %d: %w", repo.ID, err) + return fmt.Errorf("delete actions runs of repo %d: %w", repo.ID, err) } if _, err := e.Delete(&actions_model.ActionRunner{RepoID: repo.ID}); err != nil { - return fmt.Errorf("delete bots runner of repo %d: %w", repo.ID, err) + return fmt.Errorf("delete actions runner of repo %d: %w", repo.ID, err) } return nil }); err != nil { @@ -55,7 +55,7 @@ func DeleteResourceOfRepository(ctx context.Context, repo *repo_model.Repository // remove logs file after tasks have been deleted, to avoid new log files for _, task := range tasks { - err := bots_module.RemoveLogs(ctx, task.LogInStorage, task.LogFilename) + err := actions_module.RemoveLogs(ctx, task.LogInStorage, task.LogFilename) if err != nil { log.Error("remove log file %q: %v", task.LogFilename, err) // go on diff --git a/services/auth/basic.go b/services/auth/basic.go index f1d5d523a3..9f2dd30ea4 100644 --- a/services/auth/basic.go +++ b/services/auth/basic.go @@ -113,10 +113,10 @@ func (b *Basic) Verify(req *http.Request, w http.ResponseWriter, store DataStore if err == nil && task != nil { log.Trace("Basic Authorization: Valid AccessToken for task[%d]", task.ID) - store.GetData()["IsBotToken"] = true - store.GetData()["BotTaskID"] = task.ID + store.GetData()["IsActionsToken"] = true + store.GetData()["ActionsTaskID"] = task.ID - return user_model.NewBotUser() + return user_model.NewActionsUser() } if !setting.Service.EnableBasicAuth { diff --git a/services/auth/oauth2.go b/services/auth/oauth2.go index ef1aeb936c..5e24d469f3 100644 --- a/services/auth/oauth2.go +++ b/services/auth/oauth2.go @@ -98,10 +98,10 @@ func (o *OAuth2) userIDFromToken(req *http.Request, store DataStore) int64 { if err == nil && task != nil { log.Trace("Basic Authorization: Valid AccessToken for task[%d]", task.ID) - store.GetData()["IsBotToken"] = true - store.GetData()["BotTaskID"] = task.ID + store.GetData()["IsActionsToken"] = true + store.GetData()["ActionsTaskID"] = task.ID - return user_model.BotUserID + return user_model.ActionsUserID } } else if !auth_model.IsErrAccessTokenNotExist(err) && !auth_model.IsErrAccessTokenEmpty(err) { log.Error("GetAccessTokenBySHA: %v", err) @@ -130,7 +130,7 @@ func (o *OAuth2) Verify(req *http.Request, w http.ResponseWriter, store DataStor } id := o.userIDFromToken(req, store) - if id == -1 || id <= -3 { // -2 means bots, so we need to allow it. + if id == -1 || id <= -3 { // -2 means actions, so we need to allow it. return nil } log.Trace("OAuth2 Authorization: Found token for user[%d]", id) diff --git a/services/cron/cron.go b/services/cron/cron.go index 1ca41fad8b..72deb94ceb 100644 --- a/services/cron/cron.go +++ b/services/cron/cron.go @@ -30,7 +30,7 @@ func NewContext(original context.Context) { _, _, finished := process.GetManager().AddTypedContext(graceful.GetManager().ShutdownContext(), "Service: Cron", process.SystemProcessType, true) initBasicTasks() initExtendedTasks() - initBotsTasks() + initActionsTasks() lock.Lock() for _, task := range tasks { diff --git a/services/cron/tasks_actions.go b/services/cron/tasks_actions.go index f1b2f07013..b65158293b 100644 --- a/services/cron/tasks_actions.go +++ b/services/cron/tasks_actions.go @@ -10,7 +10,7 @@ import ( actions_service "code.gitea.io/gitea/services/actions" ) -func initBotsTasks() { +func initActionsTasks() { registerStopZombieTasks() registerStopEndlessTasks() registerCancelAbandonedJobs() diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index 9cb7955ea8..1628f98c24 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -147,7 +147,7 @@ type RepoSettingForm struct { EnableProjects bool EnablePackages bool EnablePulls bool - EnableBots bool + EnableActions bool PullsIgnoreWhitespace bool PullsAllowMerge bool PullsAllowRebase bool diff --git a/services/repository/push.go b/services/repository/push.go index 614093a31b..65b981df46 100644 --- a/services/repository/push.go +++ b/services/repository/push.go @@ -108,8 +108,8 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error { } if opts.IsTag() { // If is tag reference if pusher == nil || pusher.ID != opts.PusherID { - if opts.PusherID == user_model.BotUserID { - pusher = user_model.NewBotUser() + if opts.PusherID == user_model.ActionsUserID { + pusher = user_model.NewActionsUser() } else { var err error if pusher, err = user_model.GetUserByID(ctx, opts.PusherID); err != nil { @@ -152,8 +152,8 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error { } } else if opts.IsBranch() { // If is branch reference if pusher == nil || pusher.ID != opts.PusherID { - if opts.PusherID == user_model.BotUserID { - pusher = user_model.NewBotUser() + if opts.PusherID == user_model.ActionsUserID { + pusher = user_model.NewActionsUser() } else { var err error if pusher, err = user_model.GetUserByID(ctx, opts.PusherID); err != nil { diff --git a/services/repository/repository.go b/services/repository/repository.go index 5e7c204a9b..c842af16e7 100644 --- a/services/repository/repository.go +++ b/services/repository/repository.go @@ -52,9 +52,9 @@ func DeleteRepository(ctx context.Context, doer *user_model.User, repo *repo_mod return err } - // deletes bots resource after the repo has been deleted, to avoid new bots tasks + // deletes actions resource after the repo has been deleted, to avoid new tasks if err := actions_service.DeleteResourceOfRepository(ctx, repo); err != nil { - log.Error("delete bots resource failed: %v", err) + log.Error("delete actions resource failed: %v", err) } return packages_model.UnlinkRepositoryFromAllPackages(ctx, repo.ID) diff --git a/templates/admin/navbar.tmpl b/templates/admin/navbar.tmpl index 3259d4c37b..10b8755d0f 100644 --- a/templates/admin/navbar.tmpl +++ b/templates/admin/navbar.tmpl @@ -33,7 +33,7 @@ {{.locale.Tr "settings.applications"}} {{end}} - {{if .EnableBots}} + {{if .EnableActions}} {{.locale.Tr "admin.runners"}} diff --git a/templates/org/settings/navbar.tmpl b/templates/org/settings/navbar.tmpl index dfcf4aceca..69c9f0fe19 100644 --- a/templates/org/settings/navbar.tmpl +++ b/templates/org/settings/navbar.tmpl @@ -22,7 +22,7 @@ {{.locale.Tr "packages.title"}} {{end}} - {{if .EnableBots}} + {{if .EnableActions}} {{.locale.Tr "repo.runners"}} diff --git a/templates/repo/actions/build_list.tmpl b/templates/repo/actions/build_list.tmpl index e84816e62d..5d97a3553e 100644 --- a/templates/repo/actions/build_list.tmpl +++ b/templates/repo/actions/build_list.tmpl @@ -2,7 +2,7 @@ {{range .Runs}}
  • - {{template "repo/bots/status" .Status}} + {{template "repo/actions/status" .Status}}
    diff --git a/templates/repo/actions/list.tmpl b/templates/repo/actions/list.tmpl index 8f59660ddb..ccece77e3d 100644 --- a/templates/repo/actions/list.tmpl +++ b/templates/repo/actions/list.tmpl @@ -16,12 +16,12 @@
    - {{template "repo/bots/openclose" .}} + {{template "repo/actions/openclose" .}}
    - {{template "repo/bots/openclose" .}} + {{template "repo/actions/openclose" .}}
    {{/* Ten wide does not cope well and makes the columns stack. @@ -41,7 +41,7 @@
    - {{template "repo/bots/build_list" .}} + {{template "repo/actions/build_list" .}}
    diff --git a/templates/repo/actions/openclose.tmpl b/templates/repo/actions/openclose.tmpl index bb8c72707d..4a83218251 100644 --- a/templates/repo/actions/openclose.tmpl +++ b/templates/repo/actions/openclose.tmpl @@ -1,10 +1,10 @@ diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 68fc4b291a..eae7d6d24b 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -183,9 +183,9 @@ {{end}} - {{if and .EnableBots (not .UnitBotsGlobalDisabled) (.Permission.CanRead $.UnitTypeBots)}} - - {{svg "octicon-play"}} {{.locale.Tr "repo.bots"}} + {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}} + + {{svg "octicon-play"}} {{.locale.Tr "repo.actions"}} {{if .Repository.NumOpenRuns}} {{CountFmt .Repository.NumOpenRuns}} {{end}} diff --git a/templates/repo/settings/navbar.tmpl b/templates/repo/settings/navbar.tmpl index dd3d399b20..4fdd0971f1 100644 --- a/templates/repo/settings/navbar.tmpl +++ b/templates/repo/settings/navbar.tmpl @@ -32,7 +32,7 @@ {{.locale.Tr "repo.settings.lfs"}} {{end}} - {{if and .EnableBots (not .UnitBotsGlobalDisabled) (.Permission.CanRead $.UnitTypeBots)}} + {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}} {{.locale.Tr "repo.settings.runners"}} diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 861f02f960..abc1836bcb 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -420,17 +420,17 @@ - {{if .EnableBots}} - {{$isBotsEnabled := .Repository.UnitEnabled $.UnitTypeBots}} + {{if .EnableActions}} + {{$isActionsEnabled := .Repository.UnitEnabled $.UnitTypeActions}}
    - - {{if .UnitTypeBots.UnitGlobalDisabled}} + + {{if .UnitTypeActions.UnitGlobalDisabled}}
    {{else}}
    {{end}} - - + +
    {{end}}