diff --git a/models/actions/run.go b/models/actions/run.go index fc64f1bc8f..c84082e5ce 100644 --- a/models/actions/run.go +++ b/models/actions/run.go @@ -106,11 +106,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", + SetExpr("num_action_runs", builder.Select("count(*)").From("action_run"). Where(builder.Eq{"repo_id": repo.ID}), ). - SetExpr("num_closed_runs", + SetExpr("num_closed_action_runs", builder.Select("count(*)").From("action_run"). Where(builder.Eq{ "repo_id": repo.ID, diff --git a/models/migrations/v1_19/v238.go b/models/migrations/v1_19/v238.go index 0afff80a13..54a87f06cc 100644 --- a/models/migrations/v1_19/v238.go +++ b/models/migrations/v1_19/v238.go @@ -93,8 +93,8 @@ func AddActionsTables(x *xorm.Engine) error { } type Repository struct { - NumRuns int `xorm:"NOT NULL DEFAULT 0"` - NumClosedRuns int `xorm:"NOT NULL DEFAULT 0"` + NumActionRuns int `xorm:"NOT NULL DEFAULT 0"` + NumClosedActionRuns int `xorm:"NOT NULL DEFAULT 0"` } type ActionRunIndex db.ResourceIndex diff --git a/models/repo/repo.go b/models/repo/repo.go index a86850da7f..831eb22dc5 100644 --- a/models/repo/repo.go +++ b/models/repo/repo.go @@ -141,9 +141,9 @@ type Repository struct { NumProjects int `xorm:"NOT NULL DEFAULT 0"` NumClosedProjects int `xorm:"NOT NULL DEFAULT 0"` NumOpenProjects int `xorm:"-"` - NumRuns int `xorm:"NOT NULL DEFAULT 0"` - NumClosedRuns int `xorm:"NOT NULL DEFAULT 0"` - NumOpenRuns int `xorm:"-"` + NumActionRuns int `xorm:"NOT NULL DEFAULT 0"` + NumClosedActionRuns int `xorm:"NOT NULL DEFAULT 0"` + NumOpenActionRuns int `xorm:"-"` IsPrivate bool `xorm:"INDEX"` IsEmpty bool `xorm:"INDEX"` @@ -236,7 +236,7 @@ func (repo *Repository) AfterLoad() { repo.NumOpenPulls = repo.NumPulls - repo.NumClosedPulls repo.NumOpenMilestones = repo.NumMilestones - repo.NumClosedMilestones repo.NumOpenProjects = repo.NumProjects - repo.NumClosedProjects - repo.NumOpenRuns = repo.NumRuns - repo.NumClosedRuns + repo.NumOpenActionRuns = repo.NumActionRuns - repo.NumClosedActionRuns } // LoadAttributes loads attributes of the repository. diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go index 78a0307781..205feaf35c 100644 --- a/routers/web/repo/actions/actions.go +++ b/routers/web/repo/actions/actions.go @@ -96,7 +96,7 @@ func List(ctx *context.Context) { ctx.Error(http.StatusInternalServerError, err.Error()) return } - ctx.Data["NumOpenRuns"] = numOpenRuns + ctx.Data["NumOpenActionRuns"] = numOpenRuns // closed counts opts.IsClosed = util.OptionalBoolTrue diff --git a/templates/repo/actions/openclose.tmpl b/templates/repo/actions/openclose.tmpl index eabec6cf83..09d70f13aa 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 42d8f35897..bf1c66e578 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -186,8 +186,8 @@ {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}} {{svg "octicon-play"}} {{.locale.Tr "actions.actions"}} - {{if .Repository.NumOpenRuns}} - {{CountFmt .Repository.NumOpenRuns}} + {{if .Repository.NumOpenActionRuns}} + {{CountFmt .Repository.NumOpenActionRuns}} {{end}} {{end}}