diff --git a/server/api/repo.go b/server/api/repo.go index da2dbbcd4..8d4d9d5f0 100644 --- a/server/api/repo.go +++ b/server/api/repo.go @@ -28,6 +28,7 @@ import ( "github.com/rs/zerolog/log" "go.woodpecker-ci.org/woodpecker/v2/server" + "go.woodpecker-ci.org/woodpecker/v2/server/forge" "go.woodpecker-ci.org/woodpecker/v2/server/model" "go.woodpecker-ci.org/woodpecker/v2/server/router/middleware/session" "go.woodpecker-ci.org/woodpecker/v2/server/store" @@ -359,6 +360,7 @@ func GetRepoPermissions(c *gin.Context) { // @Param page query int false "for response pagination, page offset number" default(1) // @Param perPage query int false "for response pagination, max items per page" default(50) func GetRepoBranches(c *gin.Context) { + _store := store.FromContext(c) repo := session.Repo(c) user := session.User(c) _forge, err := server.Config.Services.Manager.ForgeFromRepo(repo) @@ -368,6 +370,8 @@ func GetRepoBranches(c *gin.Context) { return } + forge.Refresh(c, _forge, _store, user) + branches, err := _forge.Branches(c, user, repo, session.Pagination(c)) if err != nil { log.Error().Err(err).Msg("failed to load branches") @@ -390,6 +394,7 @@ func GetRepoBranches(c *gin.Context) { // @Param page query int false "for response pagination, page offset number" default(1) // @Param perPage query int false "for response pagination, max items per page" default(50) func GetRepoPullRequests(c *gin.Context) { + _store := store.FromContext(c) repo := session.Repo(c) user := session.User(c) _forge, err := server.Config.Services.Manager.ForgeFromRepo(repo) @@ -399,6 +404,8 @@ func GetRepoPullRequests(c *gin.Context) { return } + forge.Refresh(c, _forge, _store, user) + prs, err := _forge.PullRequests(c, user, repo, session.Pagination(c)) if err != nil { _ = c.AbortWithError(http.StatusInternalServerError, err)