|
|
@@ -4,8 +4,6 @@ import (
|
|
|
"context"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
- "github.com/porter-dev/porter/internal/models"
|
|
|
- "golang.org/x/oauth2"
|
|
|
"net/http"
|
|
|
"net/url"
|
|
|
"regexp"
|
|
|
@@ -13,6 +11,9 @@ import (
|
|
|
"strings"
|
|
|
"sync"
|
|
|
|
|
|
+ "github.com/porter-dev/porter/internal/models"
|
|
|
+ "golang.org/x/oauth2"
|
|
|
+
|
|
|
"github.com/bradleyfalzon/ghinstallation"
|
|
|
"github.com/go-chi/chi"
|
|
|
"github.com/google/go-github/github"
|
|
|
@@ -20,10 +21,13 @@ import (
|
|
|
|
|
|
// HandleListProjectGitRepos returns a list of git repos for a project
|
|
|
func (app *App) HandleListProjectGitRepos(w http.ResponseWriter, r *http.Request) {
|
|
|
-
|
|
|
tok, err := app.getGithubAppOauthTokenFromRequest(r)
|
|
|
|
|
|
if err != nil {
|
|
|
+ app.Logger.Warn().Err(err).
|
|
|
+ Str("info", "github app oauth token error").
|
|
|
+ Msg("")
|
|
|
+
|
|
|
json.NewEncoder(w).Encode(make([]*models.GitRepoExternal, 0))
|
|
|
return
|
|
|
}
|
|
|
@@ -35,6 +39,7 @@ func (app *App) HandleListProjectGitRepos(w http.ResponseWriter, r *http.Request
|
|
|
AuthUser, _, err := client.Users.Get(context.Background(), "")
|
|
|
|
|
|
if err != nil {
|
|
|
+
|
|
|
app.handleErrorInternal(err, w)
|
|
|
return
|
|
|
}
|