1
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-04-18 00:47:48 -04:00

refactor: rename to actions

This commit is contained in:
Jason Song 2022-12-06 15:16:25 +08:00
parent 56368f3963
commit 223782ca4c
No known key found for this signature in database
GPG Key ID: 8402EEEE4511A8B5
50 changed files with 247 additions and 247 deletions

View File

@ -2479,8 +2479,8 @@ ROUTER = console
;; Comma separated list of host names requiring proxy. Glob patterns (*) are accepted; use ** to match all hosts. ;; Comma separated list of host names requiring proxy. Glob patterns (*) are accepted; use ** to match all hosts.
;PROXY_HOSTS = ;PROXY_HOSTS =
; [bots] ; [actions]
;; Enable/Disable bots capabilities ;; Enable/Disable actions capabilities
;ENABLED = false ;ENABLED = false
;DEFAULT_BOTS_URL = https://gitea.com ;DEFAULT_BOTS_URL = https://gitea.com
@ -2488,7 +2488,7 @@ ROUTER = console
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; settings for packages, will override storage setting ;; settings for packages, will override storage setting
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;[storage.bots_log] ;[storage.actions_log]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; storage type ;; storage type

View File

@ -51,7 +51,7 @@ func init() {
} }
func (run *ActionRun) HTMLURL() string { 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 // 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 { func updateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) error {
_, err := db.GetEngine(ctx).ID(repo.ID). _, err := db.GetEngine(ctx).ID(repo.ID).
SetExpr("num_runs", SetExpr("num_runs",
builder.Select("count(*)").From("bot_run"). builder.Select("count(*)").From("action_run").
Where(builder.Eq{"repo_id": repo.ID}), Where(builder.Eq{"repo_id": repo.ID}),
). ).
SetExpr("num_closed_runs", SetExpr("num_closed_runs",
builder.Select("count(*)").From("bot_run"). builder.Select("count(*)").From("action_run").
Where(builder.Eq{ Where(builder.Eq{
"repo_id": repo.ID, "repo_id": repo.ID,
}.And( }.And(
@ -129,7 +129,7 @@ func updateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) err
return err return err
} }
// InsertRun inserts a bot run // InsertRun inserts a run
func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWorkflow) error { func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWorkflow) error {
ctx, commiter, err := db.TxContext(ctx) ctx, commiter, err := db.TxContext(ctx)
if err != nil { if err != nil {
@ -137,7 +137,7 @@ func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWork
} }
defer commiter.Close() 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 { if err != nil {
return err return err
} }

View File

@ -48,8 +48,8 @@ func (runs RunList) LoadTriggerUser(ctx context.Context) error {
return err return err
} }
for _, run := range runs { for _, run := range runs {
if run.TriggerUserID == user_model.BotUserID { if run.TriggerUserID == user_model.ActionsUserID {
run.TriggerUser = user_model.NewBotUser() run.TriggerUser = user_model.NewActionsUser()
} else { } else {
run.TriggerUser = users[run.TriggerUserID] run.TriggerUser = users[run.TriggerUserID]
} }

View File

@ -197,7 +197,7 @@ func FindRunners(ctx context.Context, opts FindRunnerOptions) (runners RunnerLis
return runners, sess.Find(&runners) 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) { func GetRunnerByUUID(ctx context.Context, uuid string) (*ActionRunner, error) {
var runner ActionRunner var runner ActionRunner
has, err := db.GetEngine(ctx).Where("uuid=?", uuid).Get(&runner) 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 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) { func GetRunnerByID(ctx context.Context, id int64) (*ActionRunner, error) {
var runner ActionRunner var runner ActionRunner
has, err := db.GetEngine(ctx).Where("id=?", id).Get(&runner) has, err := db.GetEngine(ctx).Where("id=?", id).Get(&runner)

View File

@ -33,7 +33,7 @@ func init() {
db.RegisterModel(new(ActionRunnerToken)) 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) { func GetRunnerToken(ctx context.Context, token string) (*ActionRunnerToken, error) {
var runnerToken ActionRunnerToken var runnerToken ActionRunnerToken
has, err := db.GetEngine(ctx).Where("token=?", token).Get(&runnerToken) has, err := db.GetEngine(ctx).Where("token=?", token).Get(&runnerToken)

View File

@ -117,7 +117,7 @@ func (task *ActionTask) GetBuildViewLink() string {
if task.Job == nil || task.Job.Run == nil || task.Job.Run.Repo == nil { if task.Job == nil || task.Job.Run == nil || task.Job.Run.Repo == nil {
return "" 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 { 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})) jobCond = builder.In("repo_id", builder.Select("id").From("repository").Where(builder.Eq{"owner_id": runner.OwnerID}))
} }
if jobCond.IsValid() { 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 var jobs []*ActionRunJob

View File

@ -35,8 +35,8 @@ func (comments CommentList) LoadPosters(ctx context.Context) error {
} }
for _, comment := range comments { for _, comment := range comments {
if comment.PosterID == user_model.BotUserID { if comment.PosterID == user_model.ActionsUserID {
comment.Poster = user_model.NewBotUser() comment.Poster = user_model.NewActionsUser()
} else if comment.PosterID <= 0 { } else if comment.PosterID <= 0 {
continue continue
} else { } else {

View File

@ -92,8 +92,8 @@ func (issues IssueList) loadPosters(ctx context.Context) error {
} }
for _, issue := range issues { for _, issue := range issues {
if issue.PosterID == user_model.BotUserID { if issue.PosterID == user_model.ActionsUserID {
issue.Poster = user_model.NewBotUser() issue.Poster = user_model.NewActionsUser()
} else if issue.PosterID <= 0 { } else if issue.PosterID <= 0 {
continue continue
} else { } else {

View File

@ -444,7 +444,7 @@ var migrations = []Migration{
NewMigration("Add index for access_token", v1_19.AddIndexForAccessToken), NewMigration("Add index for access_token", v1_19.AddIndexForAccessToken),
// in dev // in dev
NewMigration("Add bots tables", addBotTables), NewMigration("Add actions tables", addActionsTables),
} }
// GetCurrentDBVersion returns the current db version // GetCurrentDBVersion returns the current db version

View File

@ -10,8 +10,8 @@ import (
"xorm.io/xorm" "xorm.io/xorm"
) )
func addBotTables(x *xorm.Engine) error { func addActionsTables(x *xorm.Engine) error {
type BotRunner struct { type ActionRunner struct {
ID int64 ID int64
UUID string `xorm:"CHAR(36) UNIQUE"` UUID string `xorm:"CHAR(36) UNIQUE"`
Name string `xorm:"VARCHAR(32)"` Name string `xorm:"VARCHAR(32)"`
@ -39,7 +39,7 @@ func addBotTables(x *xorm.Engine) error {
Deleted timeutil.TimeStamp `xorm:"deleted"` Deleted timeutil.TimeStamp `xorm:"deleted"`
} }
type BotRunnerToken struct { type ActionRunnerToken struct {
ID int64 ID int64
Token string `xorm:"UNIQUE"` Token string `xorm:"UNIQUE"`
OwnerID int64 `xorm:"index"` // org level runner, 0 means system 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"` Deleted timeutil.TimeStamp `xorm:"deleted"`
} }
type BotRun struct { type ActionRun struct {
ID int64 ID int64
Title string Title string
RepoID int64 `xorm:"index unique(repo_index)"` RepoID int64 `xorm:"index unique(repo_index)"`
@ -71,7 +71,7 @@ func addBotTables(x *xorm.Engine) error {
Updated timeutil.TimeStamp `xorm:"updated"` Updated timeutil.TimeStamp `xorm:"updated"`
} }
type BotRunJob struct { type ActionRunJob struct {
ID int64 ID int64
RunID int64 `xorm:"index"` RunID int64 `xorm:"index"`
RepoID int64 `xorm:"index"` RepoID int64 `xorm:"index"`
@ -97,9 +97,9 @@ func addBotTables(x *xorm.Engine) error {
NumClosedRuns int `xorm:"NOT NULL DEFAULT 0"` NumClosedRuns int `xorm:"NOT NULL DEFAULT 0"`
} }
type BotRunIndex db.ResourceIndex type ActionRunIndex db.ResourceIndex
type BotTask struct { type ActionTask struct {
ID int64 ID int64
JobID int64 JobID int64
Attempt int64 Attempt int64
@ -128,7 +128,7 @@ func addBotTables(x *xorm.Engine) error {
Updated timeutil.TimeStamp `xorm:"updated index"` Updated timeutil.TimeStamp `xorm:"updated index"`
} }
type BotTaskStep struct { type ActionTaskStep struct {
ID int64 ID int64
Name string Name string
TaskID int64 `xorm:"index unique(task_number)"` TaskID int64 `xorm:"index unique(task_number)"`
@ -162,14 +162,14 @@ func addBotTables(x *xorm.Engine) error {
} }
return x.Sync( return x.Sync(
new(BotRunner), new(ActionRunner),
new(BotRunnerToken), new(ActionRunnerToken),
new(BotRun), new(ActionRun),
new(BotRunJob), new(ActionRunJob),
new(Repository), new(Repository),
new(BotRunIndex), new(ActionRunIndex),
new(BotTask), new(ActionTask),
new(BotTaskStep), new(ActionTaskStep),
new(dbfsMeta), new(dbfsMeta),
new(dbfsData), new(dbfsData),
) )

View File

@ -174,7 +174,7 @@ func (r *RepoUnit) BeforeSet(colName string, val xorm.Cell) {
r.Config = new(PullRequestsConfig) r.Config = new(PullRequestsConfig)
case unit.TypeIssues: case unit.TypeIssues:
r.Config = new(IssuesConfig) 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 fallthrough
default: default:
r.Config = new(UnitConfig) r.Config = new(UnitConfig)

View File

@ -27,7 +27,7 @@ const (
TypeExternalTracker // 7 ExternalTracker TypeExternalTracker // 7 ExternalTracker
TypeProjects // 8 Kanban board TypeProjects // 8 Kanban board
TypePackages // 9 Packages TypePackages // 9 Packages
TypeBots // 10 Bots TypeActions // 10 Actions
) )
// Value returns integer value for unit type // Value returns integer value for unit type
@ -55,8 +55,8 @@ func (u Type) String() string {
return "TypeProjects" return "TypeProjects"
case TypePackages: case TypePackages:
return "TypePackages" return "TypePackages"
case TypeBots: case TypeActions:
return "TypeBots" return "TypeActions"
} }
return fmt.Sprintf("Unknown Type %d", u) return fmt.Sprintf("Unknown Type %d", u)
} }
@ -80,7 +80,7 @@ var (
TypeExternalTracker, TypeExternalTracker,
TypeProjects, TypeProjects,
TypePackages, TypePackages,
TypeBots, TypeActions,
} }
// DefaultRepoUnits contains the default unit types // DefaultRepoUnits contains the default unit types
@ -292,11 +292,11 @@ var (
perm.AccessModeRead, perm.AccessModeRead,
} }
UnitBots = Unit{ UnitActions = Unit{
TypeBots, TypeActions,
"repo.bots", "repo.actions",
"/bots", "/actions",
"repo.bots.desc", "repo.actions.desc",
7, 7,
perm.AccessModeOwner, perm.AccessModeOwner,
} }
@ -312,7 +312,7 @@ var (
TypeExternalWiki: UnitExternalWiki, TypeExternalWiki: UnitExternalWiki,
TypeProjects: UnitProjects, TypeProjects: UnitProjects,
TypePackages: UnitPackages, TypePackages: UnitPackages,
TypeBots: UnitBots, TypeActions: UnitActions,
} }
) )

View File

@ -104,7 +104,7 @@ func MainTest(m *testing.M, testOpts *TestOptions) {
setting.Packages.Storage.Path = filepath.Join(setting.AppDataPath, "packages") 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") setting.Git.HomePath = filepath.Join(setting.AppDataPath, "home")

View File

@ -983,8 +983,8 @@ func GetPossbileUserByID(ctx context.Context, id int64) (*User, error) {
switch id { switch id {
case -1: case -1:
return NewGhostUser(), nil return NewGhostUser(), nil
case BotUserID: case ActionsUserID:
return NewBotUser(), nil return NewActionsUser(), nil
case 0: case 0:
return nil, ErrUserNotExist{} return nil, ErrUserNotExist{}
default: default:

View File

@ -36,30 +36,30 @@ func NewReplaceUser(name string) *User {
} }
const ( const (
BotUserID = -2 ActionsUserID = -2
BotUserName = "[robot]gitea-bots" ActionsUserName = "[bot]gitea-actions"
) )
// NewBotUser creates and returns a fake user for running the build. // NewActionsUser creates and returns a fake user for running the actions.
func NewBotUser() *User { func NewActionsUser() *User {
return &User{ return &User{
ID: BotUserID, ID: ActionsUserID,
Name: "[robot]gitea-bots", Name: ActionsUserName,
LowerName: "[robot]gitea-bots", LowerName: ActionsUserName,
IsActive: true, IsActive: true,
FullName: "Gitea Bots", FullName: "Gitea Actions",
Email: "teabot@gitea.io", Email: "teabot@gitea.io",
KeepEmailPrivate: true, KeepEmailPrivate: true,
LoginName: "[robot]gitea-bots", LoginName: ActionsUserName,
Type: UserTypeIndividual, Type: UserTypeIndividual,
AllowCreateOrganization: true, AllowCreateOrganization: true,
Visibility: structs.VisibleTypePublic, Visibility: structs.VisibleTypePublic,
} }
} }
func (u *User) IsBots() bool { func (u *User) IsActions() bool {
if u == nil { if u == nil {
return false return false
} }
return u.ID == BotUserID && u.Name == BotUserName return u.ID == ActionsUserID && u.Name == ActionsUserName
} }

View File

@ -22,7 +22,7 @@ import (
const ( const (
MaxLineSize = 64 * 1024 MaxLineSize = 64 * 1024
DBFSPrefix = "bots_tasks/" DBFSPrefix = "actions_tasks/"
timeFormat = "2006-01-02T15:04:05.0000000Z07:00" timeFormat = "2006-01-02T15:04:05.0000000Z07:00"
defaultBufSize = 64 * 1024 defaultBufSize = 64 * 1024
@ -103,7 +103,7 @@ func TransferLogs(ctx context.Context, filename string) (func(), error) {
} }
defer f.Close() 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 nil, fmt.Errorf("storage save %q: %w", filename, err)
} }
return remove, nil return remove, nil
@ -118,7 +118,7 @@ func RemoveLogs(ctx context.Context, inStorage bool, filename string) error {
} }
return nil return nil
} }
err := storage.Bots.Delete(filename) err := storage.Actions.Delete(filename)
if err != nil { if err != nil {
return fmt.Errorf("storage delete %q: %w", filename, err) 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 return f, nil
} }
f, err := storage.Bots.Open(filename) f, err := storage.Actions.Open(filename)
if err != nil { if err != nil {
return nil, fmt.Errorf("storage open %q: %w", filename, err) return nil, fmt.Errorf("storage open %q: %w", filename, err)
} }

View File

@ -799,7 +799,7 @@ func Contexter(ctx context.Context) func(next http.Handler) http.Handler {
ctx.Data["EnableOpenIDSignIn"] = setting.Service.EnableOpenIDSignIn ctx.Data["EnableOpenIDSignIn"] = setting.Service.EnableOpenIDSignIn
ctx.Data["DisableMigrations"] = setting.Repository.DisableMigrations ctx.Data["DisableMigrations"] = setting.Repository.DisableMigrations
ctx.Data["DisableStars"] = setting.Repository.DisableStars ctx.Data["DisableStars"] = setting.Repository.DisableStars
ctx.Data["EnableBots"] = setting.Bots.Enabled ctx.Data["EnableActions"] = setting.Actions.Enabled
ctx.Data["ManifestData"] = setting.ManifestData 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["UnitIssuesGlobalDisabled"] = unit.TypeIssues.UnitGlobalDisabled()
ctx.Data["UnitPullsGlobalDisabled"] = unit.TypePullRequests.UnitGlobalDisabled() ctx.Data["UnitPullsGlobalDisabled"] = unit.TypePullRequests.UnitGlobalDisabled()
ctx.Data["UnitProjectsGlobalDisabled"] = unit.TypeProjects.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["locale"] = locale
ctx.Data["AllLangs"] = translation.AllLangs() ctx.Data["AllLangs"] = translation.AllLangs()

View File

@ -1042,7 +1042,7 @@ func UnitTypes() func(ctx *Context) {
ctx.Data["UnitTypeExternalTracker"] = unit_model.TypeExternalTracker ctx.Data["UnitTypeExternalTracker"] = unit_model.TypeExternalTracker
ctx.Data["UnitTypeProjects"] = unit_model.TypeProjects ctx.Data["UnitTypeProjects"] = unit_model.TypeProjects
ctx.Data["UnitTypePackages"] = unit_model.TypePackages ctx.Data["UnitTypePackages"] = unit_model.TypePackages
ctx.Data["UnitTypeBots"] = unit_model.TypeBots ctx.Data["UnitTypeActions"] = unit_model.TypeActions
} }
} }

View File

@ -23,19 +23,19 @@ import (
api "code.gitea.io/gitea/modules/structs" api "code.gitea.io/gitea/modules/structs"
) )
type botsNotifier struct { type actionsNotifier struct {
base.NullNotifier 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 { func NewNotifier() base.Notifier {
return &botsNotifier{} return &actionsNotifier{}
} }
// NotifyNewIssue notifies issue created event // 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") ctx = withMethod(ctx, "NotifyNewIssue")
if err := issue.LoadRepo(ctx); err != nil { if err := issue.LoadRepo(ctx); err != nil {
log.Error("issue.LoadRepo: %v", err) 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 // 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") ctx = withMethod(ctx, "NotifyIssueChangeStatus")
mode, _ := access_model.AccessLevel(ctx, issue.Poster, issue.Repo) mode, _ := access_model.AccessLevel(ctx, issue.Poster, issue.Repo)
if issue.IsPull { if issue.IsPull {
@ -100,7 +100,7 @@ func (n *botsNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_m
Notify(ctx) 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, _, _ []*issues_model.Label,
) { ) {
ctx = withMethod(ctx, "NotifyIssueChangeLabels") 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 // 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, issue *issues_model.Issue, comment *issues_model.Comment, _ []*user_model.User,
) { ) {
ctx = withMethod(ctx, "NotifyCreateIssueComment") ctx = withMethod(ctx, "NotifyCreateIssueComment")
@ -185,7 +185,7 @@ func (n *botsNotifier) NotifyCreateIssueComment(ctx context.Context, doer *user_
Notify(ctx) 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") ctx = withMethod(ctx, "NotifyNewPullRequest")
if err := pull.LoadIssue(ctx); err != nil { if err := pull.LoadIssue(ctx); err != nil {
@ -215,7 +215,7 @@ func (n *botsNotifier) NotifyNewPullRequest(ctx context.Context, pull *issues_mo
Notify(ctx) 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") ctx = withMethod(ctx, "NotifyCreateRepository")
newNotifyInput(repo, doer, webhook.HookEventRepository).WithPayload(&api.RepositoryPayload{ newNotifyInput(repo, doer, webhook.HookEventRepository).WithPayload(&api.RepositoryPayload{
@ -226,7 +226,7 @@ func (n *botsNotifier) NotifyCreateRepository(ctx context.Context, doer, u *user
}).Notify(ctx) }).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") ctx = withMethod(ctx, "NotifyForkRepository")
oldMode, _ := access_model.AccessLevel(ctx, doer, oldRepo) 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") ctx = withMethod(ctx, "NotifyPullRequestReview")
var reviewHookType webhook.HookEventType var reviewHookType webhook.HookEventType
@ -298,7 +298,7 @@ func (n *botsNotifier) NotifyPullRequestReview(ctx context.Context, pr *issues_m
}).Notify(ctx) }).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") ctx = withMethod(ctx, "NotifyMergePullRequest")
// Reload pull request information. // Reload pull request information.
@ -339,7 +339,7 @@ func (*botsNotifier) NotifyMergePullRequest(ctx context.Context, doer *user_mode
Notify(ctx) 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") ctx = withMethod(ctx, "NotifyPushCommits")
apiPusher := convert.ToUser(pusher, nil) apiPusher := convert.ToUser(pusher, nil)
@ -365,7 +365,7 @@ func (n *botsNotifier) NotifyPushCommits(ctx context.Context, pusher *user_model
Notify(ctx) 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") ctx = withMethod(ctx, "NotifyCreateRef")
apiPusher := convert.ToUser(pusher, nil) apiPusher := convert.ToUser(pusher, nil)
@ -384,7 +384,7 @@ func (n *botsNotifier) NotifyCreateRef(ctx context.Context, pusher *user_model.U
Notify(ctx) 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") ctx = withMethod(ctx, "NotifyDeleteRef")
apiPusher := convert.ToUser(pusher, nil) apiPusher := convert.ToUser(pusher, nil)
@ -403,7 +403,7 @@ func (n *botsNotifier) NotifyDeleteRef(ctx context.Context, pusher *user_model.U
Notify(ctx) 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") ctx = withMethod(ctx, "NotifySyncPushCommits")
apiPusher := convert.ToUser(pusher, nil) apiPusher := convert.ToUser(pusher, nil)
@ -430,47 +430,47 @@ func (n *botsNotifier) NotifySyncPushCommits(ctx context.Context, pusher *user_m
Notify(ctx) 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") ctx = withMethod(ctx, "NotifySyncCreateRef")
n.NotifyCreateRef(ctx, pusher, repo, refType, refFullName, refID) 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") ctx = withMethod(ctx, "NotifySyncDeleteRef")
n.NotifyDeleteRef(ctx, pusher, repo, refType, refFullName) 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") ctx = withMethod(ctx, "NotifyNewRelease")
notifyRelease(ctx, rel.Publisher, rel, rel.Sha1, api.HookReleasePublished) 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") ctx = withMethod(ctx, "NotifyUpdateRelease")
notifyRelease(ctx, doer, rel, rel.Sha1, api.HookReleaseUpdated) 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") ctx = withMethod(ctx, "NotifyDeleteRelease")
notifyRelease(ctx, doer, rel, rel.Sha1, api.HookReleaseDeleted) 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") ctx = withMethod(ctx, "NotifyPackageCreate")
notifyPackage(ctx, doer, pd, api.HookPackageCreated) 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") ctx = withMethod(ctx, "NotifyPackageDelete")
notifyPackage(ctx, doer, pd, api.HookPackageDeleted) 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") ctx = withMethod(ctx, "NotifyAutoMergePullRequest")
n.NotifyMergePullRequest(ctx, doer, pr) 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") ctx = withMethod(ctx, "NotifyPullRequestSynchronized")
if err := pr.LoadIssue(ctx); err != nil { if err := pr.LoadIssue(ctx); err != nil {
@ -495,7 +495,7 @@ func (n *botsNotifier) NotifyPullRequestSynchronized(ctx context.Context, doer *
Notify(ctx) 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") ctx = withMethod(ctx, "NotifyPullRequestChangeTargetBranch")
if err := pr.LoadIssue(ctx); err != nil { if err := pr.LoadIssue(ctx); err != nil {

View File

@ -16,7 +16,7 @@ import (
"code.gitea.io/gitea/models/unit" "code.gitea.io/gitea/models/unit"
user_model "code.gitea.io/gitea/models/user" user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/models/webhook" "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/convert"
"code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/json" "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 { func notify(ctx context.Context, input *notifyInput) error {
if unit.TypeBots.UnitGlobalDisabled() { if unit.TypeActions.UnitGlobalDisabled() {
return nil return nil
} }
if err := input.Repo.LoadUnits(db.DefaultContext); err != nil { if err := input.Repo.LoadUnits(db.DefaultContext); err != nil {
return fmt.Errorf("repo.LoadUnits: %w", err) return fmt.Errorf("repo.LoadUnits: %w", err)
} else if !input.Repo.UnitEnabled(unit.TypeBots) { } else if !input.Repo.UnitEnabled(unit.TypeActions) {
return nil return nil
} }
@ -117,7 +117,7 @@ func notify(ctx context.Context, input *notifyInput) error {
return fmt.Errorf("gitRepo.GetCommit: %v", err) 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 { if err != nil {
return fmt.Errorf("DetectWorkflows: %v", err) return fmt.Errorf("DetectWorkflows: %v", err)
} }

View File

@ -41,14 +41,14 @@ func NewContext() {
RegisterNotifier(webhook.NewNotifier()) RegisterNotifier(webhook.NewNotifier())
RegisterNotifier(action.NewNotifier()) RegisterNotifier(action.NewNotifier())
RegisterNotifier(mirror.NewNotifier()) RegisterNotifier(mirror.NewNotifier())
if setting.Bots.Enabled { if setting.Actions.Enabled {
RegisterNotifier(actions.NewNotifier()) RegisterNotifier(actions.NewNotifier())
} }
} }
// NotifyNewWikiPage notifies creating new wiki pages to notifiers // NotifyNewWikiPage notifies creating new wiki pages to notifiers
func NotifyNewWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page, comment string) { func NotifyNewWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page, comment string) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // 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) { func NotifyEditWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page, comment string) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyDeleteWikiPage notifies deleting wiki pages to notifiers
func NotifyDeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page string) { func NotifyDeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page string) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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, 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, issue *issues_model.Issue, comment *issues_model.Comment, mentions []*user_model.User,
) { ) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -90,7 +90,7 @@ func NotifyCreateIssueComment(ctx context.Context, doer *user_model.User, repo *
// NotifyNewIssue notifies new issue to notifiers // NotifyNewIssue notifies new issue to notifiers
func NotifyNewIssue(ctx context.Context, issue *issues_model.Issue, mentions []*user_model.User) { func NotifyNewIssue(ctx context.Context, issue *issues_model.Issue, mentions []*user_model.User) {
if issue.Poster.IsBots() { if issue.Poster.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // 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) { 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 return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -110,7 +110,7 @@ func NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *
// NotifyDeleteIssue notify when some issue deleted // NotifyDeleteIssue notify when some issue deleted
func NotifyDeleteIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Issue) { func NotifyDeleteIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Issue) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyMergePullRequest notifies merge pull request to notifiers
func NotifyMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { func NotifyMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyAutoMergePullRequest notifies merge pull request to notifiers
func NotifyAutoMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { func NotifyAutoMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 { if err := pr.Issue.LoadPoster(ctx); err != nil {
return return
} }
if pr.Issue.Poster.IsBots() { if pr.Issue.Poster.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -157,7 +157,7 @@ func NotifyNewPullRequest(ctx context.Context, pr *issues_model.PullRequest, men
// NotifyPullRequestSynchronized notifies Synchronized pull request // NotifyPullRequestSynchronized notifies Synchronized pull request
func NotifyPullRequestSynchronized(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) { func NotifyPullRequestSynchronized(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -171,7 +171,7 @@ func NotifyPullRequestReview(ctx context.Context, pr *issues_model.PullRequest,
log.Error("%v", err) log.Error("%v", err)
return return
} }
if review.Reviewer.IsBots() { if review.Reviewer.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -185,7 +185,7 @@ func NotifyPullRequestCodeComment(ctx context.Context, pr *issues_model.PullRequ
log.Error("LoadPoster: %v", err) log.Error("LoadPoster: %v", err)
return return
} }
if comment.Poster.IsBots() { if comment.Poster.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // 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) { func NotifyPullRequestChangeTargetBranch(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest, oldBranch string) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // 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) { func NotifyPullRequestPushCommits(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest, comment *issues_model.Comment) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // 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) { func NotifyPullReviewDismiss(ctx context.Context, doer *user_model.User, review *issues_model.Review, comment *issues_model.Comment) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -225,7 +225,7 @@ func NotifyPullReviewDismiss(ctx context.Context, doer *user_model.User, review
// NotifyUpdateComment notifies update comment to notifiers // NotifyUpdateComment notifies update comment to notifiers
func NotifyUpdateComment(ctx context.Context, doer *user_model.User, c *issues_model.Comment, oldContent string) { func NotifyUpdateComment(ctx context.Context, doer *user_model.User, c *issues_model.Comment, oldContent string) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyDeleteComment notifies delete comment to notifiers
func NotifyDeleteComment(ctx context.Context, doer *user_model.User, c *issues_model.Comment) { func NotifyDeleteComment(ctx context.Context, doer *user_model.User, c *issues_model.Comment) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -249,7 +249,7 @@ func NotifyNewRelease(ctx context.Context, rel *repo_model.Release) {
log.Error("LoadPublisher: %v", err) log.Error("LoadPublisher: %v", err)
return return
} }
if rel.Publisher.IsBots() { if rel.Publisher.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -259,7 +259,7 @@ func NotifyNewRelease(ctx context.Context, rel *repo_model.Release) {
// NotifyUpdateRelease notifies update release to notifiers // NotifyUpdateRelease notifies update release to notifiers
func NotifyUpdateRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) { func NotifyUpdateRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyDeleteRelease notifies delete release to notifiers
func NotifyDeleteRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) { func NotifyDeleteRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyIssueChangeMilestone notifies change milestone to notifiers
func NotifyIssueChangeMilestone(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldMilestoneID int64) { func NotifyIssueChangeMilestone(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldMilestoneID int64) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -289,7 +289,7 @@ func NotifyIssueChangeMilestone(ctx context.Context, doer *user_model.User, issu
// NotifyIssueChangeContent notifies change content to notifiers // NotifyIssueChangeContent notifies change content to notifiers
func NotifyIssueChangeContent(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldContent string) { func NotifyIssueChangeContent(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldContent string) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -299,7 +299,7 @@ func NotifyIssueChangeContent(ctx context.Context, doer *user_model.User, issue
// NotifyIssueChangeAssignee notifies change content to notifiers // 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) { 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 return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -309,7 +309,7 @@ func NotifyIssueChangeAssignee(ctx context.Context, doer *user_model.User, issue
// NotifyPullReviewRequest notifies Request Review change // 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) { 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 return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -319,7 +319,7 @@ func NotifyPullReviewRequest(ctx context.Context, doer *user_model.User, issue *
// NotifyIssueClearLabels notifies clear labels to notifiers // NotifyIssueClearLabels notifies clear labels to notifiers
func NotifyIssueClearLabels(ctx context.Context, doer *user_model.User, issue *issues_model.Issue) { func NotifyIssueClearLabels(ctx context.Context, doer *user_model.User, issue *issues_model.Issue) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyIssueChangeTitle notifies change title to notifiers
func NotifyIssueChangeTitle(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldTitle string) { func NotifyIssueChangeTitle(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldTitle string) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyIssueChangeRef notifies change reference to notifiers
func NotifyIssueChangeRef(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldRef string) { func NotifyIssueChangeRef(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldRef string) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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, func NotifyIssueChangeLabels(ctx context.Context, doer *user_model.User, issue *issues_model.Issue,
addedLabels, removedLabels []*issues_model.Label, addedLabels, removedLabels []*issues_model.Label,
) { ) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -361,7 +361,7 @@ func NotifyIssueChangeLabels(ctx context.Context, doer *user_model.User, issue *
// NotifyCreateRepository notifies create repository to notifiers // NotifyCreateRepository notifies create repository to notifiers
func NotifyCreateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) { func NotifyCreateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyMigrateRepository notifies create repository to notifiers
func NotifyMigrateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) { func NotifyMigrateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyTransferRepository notifies create repository to notifiers
func NotifyTransferRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, newOwnerName string) { func NotifyTransferRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, newOwnerName string) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -391,7 +391,7 @@ func NotifyTransferRepository(ctx context.Context, doer *user_model.User, repo *
// NotifyDeleteRepository notifies delete repository to notifiers // NotifyDeleteRepository notifies delete repository to notifiers
func NotifyDeleteRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository) { func NotifyDeleteRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyForkRepository notifies fork repository to notifiers
func NotifyForkRepository(ctx context.Context, doer *user_model.User, oldRepo, repo *repo_model.Repository) { func NotifyForkRepository(ctx context.Context, doer *user_model.User, oldRepo, repo *repo_model.Repository) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {
@ -411,7 +411,7 @@ func NotifyForkRepository(ctx context.Context, doer *user_model.User, oldRepo, r
// NotifyRenameRepository notifies repository renamed // NotifyRenameRepository notifies repository renamed
func NotifyRenameRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, oldName string) { func NotifyRenameRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, oldName string) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // 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) { 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 return
} }
for _, notifier := range notifiers { 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 // 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) { func NotifyCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) {
if pusher.IsBots() { if pusher.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyDeleteRef notifies branch or tag deletion to notifiers
func NotifyDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) { func NotifyDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) {
if pusher.IsBots() { if pusher.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // 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) { 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 return
} }
for _, notifier := range notifiers { 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 // 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) { func NotifySyncCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) {
if pusher.IsBots() { if pusher.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifySyncDeleteRef notifies branch or tag deletion to notifiers
func NotifySyncDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) { func NotifySyncDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) {
if pusher.IsBots() { if pusher.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyRepoPendingTransfer notifies creation of pending transfer to notifiers
func NotifyRepoPendingTransfer(ctx context.Context, doer, newOwner *user_model.User, repo *repo_model.Repository) { func NotifyRepoPendingTransfer(ctx context.Context, doer, newOwner *user_model.User, repo *repo_model.Repository) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyPackageCreate notifies creation of a package to notifiers
func NotifyPackageCreate(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) { func NotifyPackageCreate(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { 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 // NotifyPackageDelete notifies deletion of a package to notifiers
func NotifyPackageDelete(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) { func NotifyPackageDelete(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) {
if doer.IsBots() { if doer.IsActions() {
return return
} }
for _, notifier := range notifiers { for _, notifier := range notifiers {

View File

@ -7,23 +7,23 @@ import (
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
) )
// Bots settings // Actions settings
var ( var (
Bots = struct { Actions = struct {
Storage Storage
Enabled bool Enabled bool
DefaultBotsURL string DefaultActionsURL string
}{ }{
Enabled: false, Enabled: false,
DefaultBotsURL: "https://gitea.com", DefaultActionsURL: "https://gitea.com",
} }
) )
func newBots() { func newActions() {
sec := Cfg.Section("bots") sec := Cfg.Section("actions")
if err := sec.MapTo(&Bots); err != nil { if err := sec.MapTo(&Actions); err != nil {
log.Fatal("Failed to map Bots settings: %v", err) log.Fatal("Failed to map Actions settings: %v", err)
} }
Bots.Storage = getStorage("bots_log", "", nil) Actions.Storage = getStorage("actions_log", "", nil)
} }

View File

@ -1081,7 +1081,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
newPackages() newPackages()
newBots() newActions()
if err = Cfg.Section("ui").MapTo(&UI); err != nil { if err = Cfg.Section("ui").MapTo(&UI); err != nil {
log.Fatal("Failed to map UI settings: %v", err) log.Fatal("Failed to map UI settings: %v", err)

View File

@ -126,8 +126,8 @@ var (
// Packages represents packages storage // Packages represents packages storage
Packages ObjectStorage = uninitializedStorage Packages ObjectStorage = uninitializedStorage
// Bots represents bots storage // Actions represents actions storage
Bots ObjectStorage = uninitializedStorage Actions ObjectStorage = uninitializedStorage
) )
// Init init the stoarge // Init init the stoarge
@ -139,7 +139,7 @@ func Init() error {
initLFS, initLFS,
initRepoArchives, initRepoArchives,
initPackages, initPackages,
initBots, initActions,
} { } {
if err := f(); err != nil { if err := f(); err != nil {
return err return err
@ -209,12 +209,12 @@ func initPackages() (err error) {
return err return err
} }
func initBots() (err error) { func initActions() (err error) {
if !setting.Bots.Enabled { if !setting.Actions.Enabled {
Bots = discardStorage("Bots isn't enabled") Actions = discardStorage("Actions isn't enabled")
return nil return nil
} }
log.Info("Initialising Bots storage with type: %s", setting.Bots.Storage.Type) log.Info("Initialising Actions storage with type: %s", setting.Actions.Storage.Type)
Bots, err = NewStorage(setting.Bots.Storage.Type, &setting.Bots.Storage) Actions, err = NewStorage(setting.Actions.Storage.Type, &setting.Actions.Storage)
return err return err
} }

View File

@ -1228,11 +1228,11 @@ projects.open = Open
projects.close = Close projects.close = Close
projects.board.assigned_to = Assigned to projects.board.assigned_to = Assigned to
bots = Bots actions = Actions
bots.desc = Manage bots actions.desc = Manage actions
bots.opened_by = opened %[1]s by %[2]s actions.opened_by = opened %[1]s by %[2]s
bots.open_tab = %d Open actions.open_tab = %d Open
bots.closed_tab = %d Closed actions.closed_tab = %d Closed
issues.desc = Organize bug reports, tasks and milestones. issues.desc = Organize bug reports, tasks and milestones.
issues.filter_assignees = Filter Assignee issues.filter_assignees = Filter Assignee

View File

@ -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. "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 // additional contexts
"gitea_default_bots_url": setting.Bots.DefaultBotsURL, "gitea_default_actions_url": setting.Actions.DefaultActionsURL,
}) })
return taskContext return taskContext

View File

@ -185,9 +185,9 @@ func repoAssignment() func(ctx *context.APIContext) {
repo.Owner = owner repo.Owner = owner
ctx.Repo.Repository = repo ctx.Repo.Repository = repo
if ctx.Doer != nil && ctx.Doer.ID == user_model.BotUserID { if ctx.Doer != nil && ctx.Doer.ID == user_model.ActionsUserID {
botTaskID := ctx.Data["BotTaskID"].(int64) taskID := ctx.Data["ActionsTaskID"].(int64)
task, err := actions_model.GetTaskByID(ctx, botTaskID) task, err := actions_model.GetTaskByID(ctx, taskID)
if err != nil { if err != nil {
ctx.Error(http.StatusInternalServerError, "actions_model.GetTaskByID", err) ctx.Error(http.StatusInternalServerError, "actions_model.GetTaskByID", err)
return return
@ -239,7 +239,7 @@ func reqPackageAccess(accessMode perm.AccessMode) func(ctx *context.APIContext)
// Contexter middleware already checks token for user sign in process. // Contexter middleware already checks token for user sign in process.
func reqToken() func(ctx *context.APIContext) { func reqToken() func(ctx *context.APIContext) {
return 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 return
} }
if ctx.Context.IsBasicAuth { if ctx.Context.IsBasicAuth {

View File

@ -202,8 +202,8 @@ func NormalRoutes(ctx context.Context) *web.Route {
r.Mount("/v2", packages_router.ContainerRoutes(ctx)) r.Mount("/v2", packages_router.ContainerRoutes(ctx))
} }
if setting.Bots.Enabled { if setting.Actions.Enabled {
prefix := "/api/bots" prefix := "/api/actions"
r.Mount(prefix, actions_router.Routes(ctx, prefix)) r.Mount(prefix, actions_router.Routes(ctx, prefix))
} }

View File

@ -464,8 +464,8 @@ func (ctx *preReceiveContext) loadPusherAndPermission() bool {
return true return true
} }
if ctx.opts.UserID == user_model.BotUserID { if ctx.opts.UserID == user_model.ActionsUserID {
ctx.user = user_model.NewBotUser() ctx.user = user_model.NewActionsUser()
ctx.userPerm.AccessMode = perm_model.AccessModeAdmin ctx.userPerm.AccessMode = perm_model.AccessModeAdmin
if err := ctx.Repo.Repository.LoadUnits(ctx); err != nil { if err := ctx.Repo.Repository.LoadUnits(ctx); err != nil {
log.Error("Unable to get User id %d Error: %v", ctx.opts.UserID, err) log.Error("Unable to get User id %d Error: %v", ctx.opts.UserID, err)

View File

@ -18,33 +18,33 @@ import (
) )
const ( const (
tplListBots base.TplName = "repo/bots/list" tplListActions base.TplName = "repo/actions/list"
tplViewBuild base.TplName = "repo/bots/view" tplViewActions base.TplName = "repo/actions/view"
) )
// MustEnableBots check if bots are enabled in settings // MustEnableActions check if actions are enabled in settings
func MustEnableBots(ctx *context.Context) { func MustEnableActions(ctx *context.Context) {
if !setting.Bots.Enabled { if !setting.Actions.Enabled {
ctx.NotFound("MustEnableBots", nil) ctx.NotFound("MustEnableActions", nil)
return return
} }
if unit.TypeBots.UnitGlobalDisabled() { if unit.TypeActions.UnitGlobalDisabled() {
ctx.NotFound("MustEnableBots", nil) ctx.NotFound("MustEnableActions", nil)
return return
} }
if ctx.Repo.Repository != nil { if ctx.Repo.Repository != nil {
if !ctx.Repo.CanRead(unit.TypeBots) { if !ctx.Repo.CanRead(unit.TypeActions) {
ctx.NotFound("MustEnableBots", nil) ctx.NotFound("MustEnableActions", nil)
return return
} }
} }
} }
func List(ctx *context.Context) { func List(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.bots") ctx.Data["Title"] = ctx.Tr("repo.actions")
ctx.Data["PageIsBots"] = true ctx.Data["PageIsActions"] = true
defaultBranch, err := ctx.Repo.GitRepo.GetDefaultBranch() defaultBranch, err := ctx.Repo.GitRepo.GetDefaultBranch()
if err != nil { if err != nil {
@ -129,5 +129,5 @@ func List(ctx *context.Context) {
pager.SetDefaultParams(ctx) pager.SetDefaultParams(ctx)
ctx.Data["Page"] = pager ctx.Data["Page"] = pager
ctx.HTML(http.StatusOK, tplListBots) ctx.HTML(http.StatusOK, tplListActions)
} }

View File

@ -24,7 +24,7 @@ import (
) )
func View(ctx *context_module.Context) { func View(ctx *context_module.Context) {
ctx.Data["PageIsBots"] = true ctx.Data["PageIsActions"] = true
runIndex := ctx.ParamsInt64("run") runIndex := ctx.ParamsInt64("run")
jobIndex := ctx.ParamsInt64("job") jobIndex := ctx.ParamsInt64("job")
ctx.Data["RunIndex"] = runIndex ctx.Data["RunIndex"] = runIndex
@ -37,7 +37,7 @@ func View(ctx *context_module.Context) {
run := job.Run run := job.Run
ctx.Data["Build"] = run ctx.Data["Build"] = run
ctx.HTML(http.StatusOK, tplViewBuild) ctx.HTML(http.StatusOK, tplViewActions)
} }
type ViewRequest struct { type ViewRequest struct {

View File

@ -164,7 +164,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) {
return 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) _, err = auth.GetTwoFactorByUID(ctx.Doer.ID)
if err == nil { 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 // 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 accessMode = perm.AccessModeRead
} }
if ctx.Data["IsBotToken"] == true { if ctx.Data["IsActionsToken"] == true {
taskID := ctx.Data["BotTaskID"].(int64) taskID := ctx.Data["ActionsTaskID"].(int64)
task, err := actions_model.GetTaskByID(ctx, taskID) task, err := actions_model.GetTaskByID(ctx, taskID)
if err != nil { if err != nil {
ctx.ServerError("GetTaskByID", err) ctx.ServerError("GetTaskByID", err)

View File

@ -489,13 +489,13 @@ func SettingsPost(ctx *context.Context) {
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypePackages) 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{ units = append(units, repo_model.RepoUnit{
RepoID: repo.ID, RepoID: repo.ID,
Type: unit_model.TypeBots, Type: unit_model.TypeActions,
}) })
} else if !unit_model.TypeBots.UnitGlobalDisabled() { } else if !unit_model.TypeActions.UnitGlobalDisabled() {
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeBots) deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeActions)
} }
if form.EnablePulls && !unit_model.TypePullRequests.UnitGlobalDisabled() { if form.EnablePulls && !unit_model.TypePullRequests.UnitGlobalDisabled() {

View File

@ -629,7 +629,7 @@ func RegisterRoutes(m *web.Route) {
m.Get("/reset_registration_token", admin.ResetRunnerRegistrationToken) m.Get("/reset_registration_token", admin.ResetRunnerRegistrationToken)
m.Combo("/{runnerid}").Get(admin.EditRunner).Post(bindIgnErr(forms.EditRunnerForm{}), admin.EditRunnerPost) m.Combo("/{runnerid}").Get(admin.EditRunner).Post(bindIgnErr(forms.EditRunnerForm{}), admin.EditRunnerPost)
m.Post("/{runnerid}/delete", admin.DeleteRunnerPost) m.Post("/{runnerid}/delete", admin.DeleteRunnerPost)
}, actions.MustEnableBots) }, actions.MustEnableActions)
}, func(ctx *context.Context) { }, func(ctx *context.Context) {
ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable
ctx.Data["EnablePackages"] = setting.Packages.Enabled ctx.Data["EnablePackages"] = setting.Packages.Enabled
@ -672,7 +672,7 @@ func RegisterRoutes(m *web.Route) {
reqRepoIssuesOrPullsReader := context.RequireRepoReaderOr(unit.TypeIssues, unit.TypePullRequests) reqRepoIssuesOrPullsReader := context.RequireRepoReaderOr(unit.TypeIssues, unit.TypePullRequests)
reqRepoProjectsReader := context.RequireRepoReader(unit.TypeProjects) reqRepoProjectsReader := context.RequireRepoReader(unit.TypeProjects)
reqRepoProjectsWriter := context.RequireRepoWriter(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) { reqPackageAccess := func(accessMode perm.AccessMode) func(ctx *context.Context) {
return func(ctx *context.Context) { return func(ctx *context.Context) {
@ -792,7 +792,7 @@ func RegisterRoutes(m *web.Route) {
Post(bindIgnErr(forms.EditRunnerForm{}), org.RunnersEditPost) Post(bindIgnErr(forms.EditRunnerForm{}), org.RunnersEditPost)
m.Post("/{runnerid}/delete", org.RunnerDeletePost) m.Post("/{runnerid}/delete", org.RunnerDeletePost)
m.Get("/reset_registration_token", org.ResetRunnerRegistrationToken) m.Get("/reset_registration_token", org.ResetRunnerRegistrationToken)
}, actions.MustEnableBots) }, actions.MustEnableActions)
m.Group("/secrets", func() { m.Group("/secrets", func() {
m.Get("", org.Secrets) m.Get("", org.Secrets)
@ -960,7 +960,7 @@ func RegisterRoutes(m *web.Route) {
Post(bindIgnErr(forms.EditRunnerForm{}), repo.RunnersEditPost) Post(bindIgnErr(forms.EditRunnerForm{}), repo.RunnersEditPost)
m.Post("/{runnerid}/delete", repo.RunnerDeletePost) m.Post("/{runnerid}/delete", repo.RunnerDeletePost)
m.Get("/reset_registration_token", repo.ResetRunnerRegistrationToken) m.Get("/reset_registration_token", repo.ResetRunnerRegistrationToken)
}, actions.MustEnableBots) }, actions.MustEnableActions)
}, func(ctx *context.Context) { }, func(ctx *context.Context) {
ctx.Data["PageIsSettings"] = true ctx.Data["PageIsSettings"] = true
ctx.Data["LFSStartServer"] = setting.LFS.StartServer ctx.Data["LFSStartServer"] = setting.LFS.StartServer
@ -1199,7 +1199,7 @@ func RegisterRoutes(m *web.Route) {
}, reqRepoProjectsWriter, context.RepoMustNotBeArchived()) }, reqRepoProjectsWriter, context.RepoMustNotBeArchived())
}, reqRepoProjectsReader, repo.MustEnableProjects) }, reqRepoProjectsReader, repo.MustEnableProjects)
m.Group("/bots", func() { m.Group("/actions", func() {
m.Get("", actions.List) m.Get("", actions.List)
m.Group("/runs/{run}", func() { m.Group("/runs/{run}", func() {
@ -1214,7 +1214,7 @@ func RegisterRoutes(m *web.Route) {
}) })
m.Post("/cancel", actions.Cancel) m.Post("/cancel", actions.Cancel)
}) })
}, reqRepoBotsReader, actions.MustEnableBots) }, reqRepoActionsReader, actions.MustEnableActions)
m.Group("/wiki", func() { m.Group("/wiki", func() {
m.Combo("/"). m.Combo("/").

View File

@ -13,7 +13,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo" repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user" user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/models/webhook" "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/graceful"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/queue" "code.gitea.io/gitea/modules/queue"
@ -21,7 +21,7 @@ import (
) )
func Init() { 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) 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 { if err := db.WithTx(ctx, func(ctx context.Context) error {
e := db.GetEngine(ctx) e := db.GetEngine(ctx)
if _, err := e.Delete(&actions_model.ActionTaskStep{RepoID: repo.ID}); err != nil { 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 { 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 { 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 { 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 { 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 return nil
}); err != 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 // remove logs file after tasks have been deleted, to avoid new log files
for _, task := range tasks { 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 { if err != nil {
log.Error("remove log file %q: %v", task.LogFilename, err) log.Error("remove log file %q: %v", task.LogFilename, err)
// go on // go on

View File

@ -113,10 +113,10 @@ func (b *Basic) Verify(req *http.Request, w http.ResponseWriter, store DataStore
if err == nil && task != nil { if err == nil && task != nil {
log.Trace("Basic Authorization: Valid AccessToken for task[%d]", task.ID) log.Trace("Basic Authorization: Valid AccessToken for task[%d]", task.ID)
store.GetData()["IsBotToken"] = true store.GetData()["IsActionsToken"] = true
store.GetData()["BotTaskID"] = task.ID store.GetData()["ActionsTaskID"] = task.ID
return user_model.NewBotUser() return user_model.NewActionsUser()
} }
if !setting.Service.EnableBasicAuth { if !setting.Service.EnableBasicAuth {

View File

@ -98,10 +98,10 @@ func (o *OAuth2) userIDFromToken(req *http.Request, store DataStore) int64 {
if err == nil && task != nil { if err == nil && task != nil {
log.Trace("Basic Authorization: Valid AccessToken for task[%d]", task.ID) log.Trace("Basic Authorization: Valid AccessToken for task[%d]", task.ID)
store.GetData()["IsBotToken"] = true store.GetData()["IsActionsToken"] = true
store.GetData()["BotTaskID"] = task.ID store.GetData()["ActionsTaskID"] = task.ID
return user_model.BotUserID return user_model.ActionsUserID
} }
} else if !auth_model.IsErrAccessTokenNotExist(err) && !auth_model.IsErrAccessTokenEmpty(err) { } else if !auth_model.IsErrAccessTokenNotExist(err) && !auth_model.IsErrAccessTokenEmpty(err) {
log.Error("GetAccessTokenBySHA: %v", 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) 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 return nil
} }
log.Trace("OAuth2 Authorization: Found token for user[%d]", id) log.Trace("OAuth2 Authorization: Found token for user[%d]", id)

View File

@ -30,7 +30,7 @@ func NewContext(original context.Context) {
_, _, finished := process.GetManager().AddTypedContext(graceful.GetManager().ShutdownContext(), "Service: Cron", process.SystemProcessType, true) _, _, finished := process.GetManager().AddTypedContext(graceful.GetManager().ShutdownContext(), "Service: Cron", process.SystemProcessType, true)
initBasicTasks() initBasicTasks()
initExtendedTasks() initExtendedTasks()
initBotsTasks() initActionsTasks()
lock.Lock() lock.Lock()
for _, task := range tasks { for _, task := range tasks {

View File

@ -10,7 +10,7 @@ import (
actions_service "code.gitea.io/gitea/services/actions" actions_service "code.gitea.io/gitea/services/actions"
) )
func initBotsTasks() { func initActionsTasks() {
registerStopZombieTasks() registerStopZombieTasks()
registerStopEndlessTasks() registerStopEndlessTasks()
registerCancelAbandonedJobs() registerCancelAbandonedJobs()

View File

@ -147,7 +147,7 @@ type RepoSettingForm struct {
EnableProjects bool EnableProjects bool
EnablePackages bool EnablePackages bool
EnablePulls bool EnablePulls bool
EnableBots bool EnableActions bool
PullsIgnoreWhitespace bool PullsIgnoreWhitespace bool
PullsAllowMerge bool PullsAllowMerge bool
PullsAllowRebase bool PullsAllowRebase bool

View File

@ -108,8 +108,8 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
} }
if opts.IsTag() { // If is tag reference if opts.IsTag() { // If is tag reference
if pusher == nil || pusher.ID != opts.PusherID { if pusher == nil || pusher.ID != opts.PusherID {
if opts.PusherID == user_model.BotUserID { if opts.PusherID == user_model.ActionsUserID {
pusher = user_model.NewBotUser() pusher = user_model.NewActionsUser()
} else { } else {
var err error var err error
if pusher, err = user_model.GetUserByID(ctx, opts.PusherID); err != nil { 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 } else if opts.IsBranch() { // If is branch reference
if pusher == nil || pusher.ID != opts.PusherID { if pusher == nil || pusher.ID != opts.PusherID {
if opts.PusherID == user_model.BotUserID { if opts.PusherID == user_model.ActionsUserID {
pusher = user_model.NewBotUser() pusher = user_model.NewActionsUser()
} else { } else {
var err error var err error
if pusher, err = user_model.GetUserByID(ctx, opts.PusherID); err != nil { if pusher, err = user_model.GetUserByID(ctx, opts.PusherID); err != nil {

View File

@ -52,9 +52,9 @@ func DeleteRepository(ctx context.Context, doer *user_model.User, repo *repo_mod
return err 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 { 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) return packages_model.UnlinkRepositoryFromAllPackages(ctx, repo.ID)

View File

@ -33,7 +33,7 @@
{{.locale.Tr "settings.applications"}} {{.locale.Tr "settings.applications"}}
</a> </a>
{{end}} {{end}}
{{if .EnableBots}} {{if .EnableActions}}
<a class="{{if .PageIsAdminRunners}}active{{end}} item" href="{{AppSubUrl}}/admin/runners"> <a class="{{if .PageIsAdminRunners}}active{{end}} item" href="{{AppSubUrl}}/admin/runners">
{{.locale.Tr "admin.runners"}} {{.locale.Tr "admin.runners"}}
</a> </a>

View File

@ -22,7 +22,7 @@
{{.locale.Tr "packages.title"}} {{.locale.Tr "packages.title"}}
</a> </a>
{{end}} {{end}}
{{if .EnableBots}} {{if .EnableActions}}
<a class="{{if .PageIsOrgSettingsRunners}}active{{end}} item" href="{{.OrgLink}}/settings/runners"> <a class="{{if .PageIsOrgSettingsRunners}}active{{end}} item" href="{{.OrgLink}}/settings/runners">
{{.locale.Tr "repo.runners"}} {{.locale.Tr "repo.runners"}}
</a> </a>

View File

@ -2,7 +2,7 @@
{{range .Runs}} {{range .Runs}}
<li class="item df py-3"> <li class="item df py-3">
<div class="issue-item-left df"> <div class="issue-item-left df">
{{template "repo/bots/status" .Status}} {{template "repo/actions/status" .Status}}
</div> </div>
<div class="issue-item-main f1 fc df"> <div class="issue-item-main f1 fc df">
<div class="issue-item-top-row"> <div class="issue-item-top-row">

View File

@ -16,12 +16,12 @@
<div class="twelve wide column content"> <div class="twelve wide column content">
<div id="issue-filters" class="ui stackable grid"> <div id="issue-filters" class="ui stackable grid">
<div class="six wide column"> <div class="six wide column">
{{template "repo/bots/openclose" .}} {{template "repo/actions/openclose" .}}
</div> </div>
</div> </div>
<div id="issue-actions" class="ui stackable grid hide"> <div id="issue-actions" class="ui stackable grid hide">
<div class="six wide column"> <div class="six wide column">
{{template "repo/bots/openclose" .}} {{template "repo/actions/openclose" .}}
</div> </div>
<div class="ui divider"></div> <div class="ui divider"></div>
{{/* Ten wide does not cope well and makes the columns stack. {{/* Ten wide does not cope well and makes the columns stack.
@ -41,7 +41,7 @@
</div> </div>
</div> </div>
</div> </div>
{{template "repo/bots/build_list" .}} {{template "repo/actions/build_list" .}}
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,10 +1,10 @@
<div class="ui compact tiny menu"> <div class="ui compact tiny menu">
<a class="{{if not .IsShowClosed}}active{{end}} item" href="{{$.Link}}?workflow={{.CurWorkflow}}&state=open"> <a class="{{if not .IsShowClosed}}active{{end}} item" href="{{$.Link}}?workflow={{.CurWorkflow}}&state=open">
{{svg "octicon-issue-opened" 16 "mr-3"}} {{svg "octicon-issue-opened" 16 "mr-3"}}
{{.locale.Tr "repo.bots.open_tab" $.NumOpenRuns}} {{.locale.Tr "repo.actions.open_tab" $.NumOpenRuns}}
</a> </a>
<a class="{{if .IsShowClosed}}active{{end}} item" href="{{$.Link}}?workflow={{.CurWorkflow}}&state=closed"> <a class="{{if .IsShowClosed}}active{{end}} item" href="{{$.Link}}?workflow={{.CurWorkflow}}&state=closed">
{{svg "octicon-issue-closed" 16 "mr-3"}} {{svg "octicon-issue-closed" 16 "mr-3"}}
{{.locale.Tr "repo.bots.closed_tab" $.NumClosedRuns}} {{.locale.Tr "repo.actions.closed_tab" $.NumClosedRuns}}
</a> </a>
</div> </div>

View File

@ -183,9 +183,9 @@
</a> </a>
{{end}} {{end}}
{{if and .EnableBots (not .UnitBotsGlobalDisabled) (.Permission.CanRead $.UnitTypeBots)}} {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}}
<a class="{{if .PageIsBots}}active{{end}} item" href="{{.RepoLink}}/bots"> <a class="{{if .PageIsActions}}active{{end}} item" href="{{.RepoLink}}/actions">
{{svg "octicon-play"}} {{.locale.Tr "repo.bots"}} {{svg "octicon-play"}} {{.locale.Tr "repo.actions"}}
{{if .Repository.NumOpenRuns}} {{if .Repository.NumOpenRuns}}
<span class="ui blue small label">{{CountFmt .Repository.NumOpenRuns}}</span> <span class="ui blue small label">{{CountFmt .Repository.NumOpenRuns}}</span>
{{end}} {{end}}

View File

@ -32,7 +32,7 @@
{{.locale.Tr "repo.settings.lfs"}} {{.locale.Tr "repo.settings.lfs"}}
</a> </a>
{{end}} {{end}}
{{if and .EnableBots (not .UnitBotsGlobalDisabled) (.Permission.CanRead $.UnitTypeBots)}} {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}}
<a class="{{if .PageIsSettingsRunners}}active{{end}} item" href="{{.RepoLink}}/settings/runners"> <a class="{{if .PageIsSettingsRunners}}active{{end}} item" href="{{.RepoLink}}/settings/runners">
{{.locale.Tr "repo.settings.runners"}} {{.locale.Tr "repo.settings.runners"}}
</a> </a>

View File

@ -420,17 +420,17 @@
</div> </div>
</div> </div>
{{if .EnableBots}} {{if .EnableActions}}
{{$isBotsEnabled := .Repository.UnitEnabled $.UnitTypeBots}} {{$isActionsEnabled := .Repository.UnitEnabled $.UnitTypeActions}}
<div class="inline field"> <div class="inline field">
<label>{{.locale.Tr "repo.bots"}}</label> <label>{{.locale.Tr "repo.actions"}}</label>
{{if .UnitTypeBots.UnitGlobalDisabled}} {{if .UnitTypeActions.UnitGlobalDisabled}}
<div class="ui checkbox tooltip disabled" data-content="{{.locale.Tr "repo.unit_disabled"}}"> <div class="ui checkbox tooltip disabled" data-content="{{.locale.Tr "repo.unit_disabled"}}">
{{else}} {{else}}
<div class="ui checkbox"> <div class="ui checkbox">
{{end}} {{end}}
<input class="enable-system" name="enable_bots" type="checkbox" {{if $isBotsEnabled}}checked{{end}}> <input class="enable-system" name="enable_actions" type="checkbox" {{if $isActionsEnabled}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.bots_desc"}}</label> <label>{{.locale.Tr "repo.settings.actions_desc"}}</label>
</div> </div>
</div> </div>
{{end}} {{end}}