Add workflow

This commit is contained in:
Lunny Xiao
2022-10-17 00:32:00 +08:00
committed by Jason Song
parent f75a4abc5d
commit 243c1e5134
3 changed files with 39 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/bots"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/util"
@@ -40,6 +41,25 @@ func List(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.builds")
ctx.Data["PageIsBuildList"] = true
defaultBranch, err := ctx.Repo.GitRepo.GetDefaultBranch()
if err != nil {
ctx.Error(http.StatusInternalServerError, err.Error())
return
}
commit, err := ctx.Repo.GitRepo.GetBranchCommit(defaultBranch)
if err != nil {
ctx.Error(http.StatusInternalServerError, err.Error())
return
}
workflows, err := bots.ListWorkflows(commit)
if err != nil {
ctx.Error(http.StatusInternalServerError, err.Error())
return
}
ctx.Data["workflows"] = workflows
page := ctx.FormInt("page")
if page <= 0 {
page = 1