Skip to content

Commit 116f8e1

Browse files
authored
Optimize actions list by removing an unnecessary git call (#24710)
We already have the default branch so we don't need to make a `git` call to get it.
1 parent 22da9da commit 116f8e1

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

routers/web/repo/actions/actions.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ func List(ctx *context.Context) {
6161
ctx.Error(http.StatusInternalServerError, err.Error())
6262
return
6363
} else if !empty {
64-
defaultBranch, err := ctx.Repo.GitRepo.GetDefaultBranch()
65-
if err != nil {
66-
ctx.Error(http.StatusInternalServerError, err.Error())
67-
return
68-
}
69-
commit, err := ctx.Repo.GitRepo.GetBranchCommit(defaultBranch)
64+
commit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.Repository.DefaultBranch)
7065
if err != nil {
7166
ctx.Error(http.StatusInternalServerError, err.Error())
7267
return

0 commit comments

Comments
 (0)