From 354034b69d2aa3823cd78c1d8984906591fcb02f Mon Sep 17 00:00:00 2001 From: Mohamed Habib Date: Mon, 18 Nov 2024 13:01:26 +0000 Subject: [PATCH] use hostname in both github and caching (#1831) --- backend/controllers/cache.go | 9 +-------- backend/controllers/github.go | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/backend/controllers/cache.go b/backend/controllers/cache.go index 4d9aa398..82ca37fd 100644 --- a/backend/controllers/cache.go +++ b/backend/controllers/cache.go @@ -52,16 +52,9 @@ func (d DiggerController) UpdateRepoCache(c *gin.Context) { return } - cloneUrl := repo.RepoUrl + cloneUrl := fmt.Sprintf("https://%v/%v", utils.GetGithubHostname(), repo.RepoFullName) branch := request.Branch - //ghInstallation, err := models.DB.GetInstallationForRepo(repoFullName) - //if err != nil { - // log.Printf("could not get repo: %v", err) - // c.String(500, fmt.Sprintf("coulnt not get repository %v %v", repoFullName, orgId)) - // return - //} - _, token, err := utils.GetGithubService(d.GithubClientProvider, installationId, repoFullName, repoOwner, repoName) if err != nil { log.Printf("could not get github service :%v", err) diff --git a/backend/controllers/github.go b/backend/controllers/github.go index b11cc706..76fbcfd5 100644 --- a/backend/controllers/github.go +++ b/backend/controllers/github.go @@ -1163,7 +1163,7 @@ func (d DiggerController) GithubAppCallbackPage(c *gin.Context) { repoFullName := *repo.FullName repoOwner := strings.Split(*repo.FullName, "/")[0] repoName := *repo.Name - repoUrl := fmt.Sprintf("https://github.com/%v", repoFullName) + repoUrl := fmt.Sprintf("https://%v/%v", utils.GetGithubHostname(), repoFullName) _, err := models.DB.GithubRepoAdded(installationId64, *installation.AppID, *installation.Account.Login, *installation.Account.ID, repoFullName) if err != nil { log.Printf("github repos added error: %v", err)