From 66be5c5dcb17783ef8a529825e8936c47bc22f93 Mon Sep 17 00:00:00 2001 From: shohamroditimemphis Date: Thu, 26 Oct 2023 13:23:48 +0300 Subject: [PATCH 1/5] update get all functions endpoint --- models/functions.go | 31 +++++++------- server/memphis_handlers_functions_cloud.go | 42 ++++++++++++------- server/source_code_management_cloud.go | 14 +++---- server/source_code_management_github_cloud.go | 36 +++++++++++++--- 4 files changed, 81 insertions(+), 42 deletions(-) diff --git a/models/functions.go b/models/functions.go index dba259f93..411a50ff1 100644 --- a/models/functions.go +++ b/models/functions.go @@ -14,20 +14,23 @@ package models import "time" type FunctionsResult struct { - FunctionName string `json:"function_name"` - Description string `json:"description"` - Tags []string `json:"tags"` - RunTime string `json:"runtime"` - Memory int `json:"memory"` - Storgae int `json:"storgae"` - LastCommit time.Time `json:"last_commit"` - Link string `json:"link"` - Repository string `json:"repository"` - Branch string `json:"branch"` - Owner string `json:"owner"` - EnvironmentVars map[string]string `json:"environment_vars"` - ScmType string `json:"scm_type"` - Language string `json:"language"` + FunctionName string `json:"function_name"` + Description string `json:"description"` + Tags []string `json:"tags"` + RunTime string `json:"runtime"` + Memory int `json:"memory"` + Storgae int `json:"storgae"` + LastCommit time.Time `json:"last_commit"` + Link *string `json:"link"` + Repository string `json:"repository"` + Branch string `json:"branch"` + Owner string `json:"owner"` + EnvironmentVars map[string]string `json:"environment_vars"` + ScmType string `json:"scm_type"` + Language string `json:"language"` + InstallInProgress bool `json:"install_in_progress"` + UpdatesAvailable bool `json:"updates_available"` + ByMemphis bool `json:"by_memphis"` } type FunctionsRes struct { diff --git a/server/memphis_handlers_functions_cloud.go b/server/memphis_handlers_functions_cloud.go index 440223c2b..987d742b2 100644 --- a/server/memphis_handlers_functions_cloud.go +++ b/server/memphis_handlers_functions_cloud.go @@ -50,7 +50,7 @@ func (fh FunctionsHandler) GetAllFunctions(c *gin.Context) { } } - c.IndentedJSON(200, gin.H{"scm_integrated": functionsResult.ScmIntegrated, "functions": functionsResult.Functions}) + c.IndentedJSON(200, gin.H{"scm_integrated": functionsResult.ScmIntegrated, "other": functionsResult.Functions, "installed": []models.FunctionsRes{}, "connected_repos": []map[string]interface{}{}}) } func (fh FunctionsHandler) GetFunctions(tenantName string) (models.FunctionsRes, error) { @@ -62,6 +62,9 @@ func (fh FunctionsHandler) GetFunctions(tenantName string) (models.FunctionsRes, if err != nil { return models.FunctionsRes{}, err } + if len(functions) > 10 { + functions = functions[:10] + } allFunctions := models.FunctionsRes{ Functions: functions, ScmIntegrated: scmIntegrated, @@ -209,7 +212,7 @@ func GetFunctionsDetails(functionsDetails []functionDetails) ([]models.Functions for _, functionDetails := range functionsDetails { fucntionContentMap := functionDetails.ContentMap commit := functionDetails.Commit - fileContent := functionDetails.Content + link := functionDetails.DirectoryUrl repo := functionDetails.RepoName branch := functionDetails.Branch owner := functionDetails.Owner @@ -253,20 +256,29 @@ func GetFunctionsDetails(functionsDetails []functionDetails) ([]models.Functions language = strings.Trim(language, ".-edge") } + byMemphis := false + if repo == memphisDevFunctionsRepoName { + byMemphis = true + } + functionDetails := models.FunctionsResult{ - FunctionName: fucntionContentMap["function_name"].(string), - Description: description, - Tags: tagsStrings, - RunTime: runtime, - LastCommit: *commit.Commit.Committer.Date, - Link: *fileContent.HTMLURL, - Repository: repo, - Branch: branch, - Owner: owner, - Memory: fucntionContentMap["memory"].(int), - Storgae: fucntionContentMap["storage"].(int), - EnvironmentVars: environmentVarsStrings, - Language: language, + FunctionName: fucntionContentMap["function_name"].(string), + Description: description, + Tags: tagsStrings, + RunTime: runtime, + LastCommit: *commit.Commit.Committer.Date, + Link: link, + Repository: repo, + Branch: branch, + Owner: owner, + Memory: fucntionContentMap["memory"].(int), + Storgae: fucntionContentMap["storage"].(int), + EnvironmentVars: environmentVarsStrings, + Language: language, + ScmType: "github", + InstallInProgress: false, + UpdatesAvailable: false, + ByMemphis: byMemphis, } functions = append(functions, functionDetails) diff --git a/server/source_code_management_cloud.go b/server/source_code_management_cloud.go index bb2eb3371..b721a6185 100644 --- a/server/source_code_management_cloud.go +++ b/server/source_code_management_cloud.go @@ -22,13 +22,13 @@ type GetSourceCodeBranchesSchema struct { } type functionDetails struct { - Content *github.RepositoryContent `json:"content"` - Commit *github.RepositoryCommit `json:"commit"` - ContentMap map[string]interface{} `json:"content_map"` - RepoName string `json:"repo_name"` - Branch string `json:"branch"` - Scm string `json:"scm"` - Owner string `json:"owner"` + DirectoryUrl *string `json:"directory_content"` + Commit *github.RepositoryCommit `json:"commit"` + ContentMap map[string]interface{} `json:"content_map"` + RepoName string `json:"repo_name"` + Branch string `json:"branch"` + Scm string `json:"scm"` + Owner string `json:"owner"` } func getSourceCodeDetails(tenantName string, getAllReposSchema interface{}, actionType string) (models.Integration, interface{}, error) { diff --git a/server/source_code_management_github_cloud.go b/server/source_code_management_github_cloud.go index bb06832e0..87e35c0e3 100644 --- a/server/source_code_management_github_cloud.go +++ b/server/source_code_management_github_cloud.go @@ -125,6 +125,30 @@ func GetGithubContentFromConnectedRepo(connectedRepo map[string]interface{}, fun contentMap["storage"] = int64(512) * 1024 * 1024 } + // TODO: need to add according to the cloud changes + // if contentMap["dependencies"].(string) == "" { + // switch contentMap["language"] { + // case "go": + // contentMap["dependencies"] = "go.mod" + // case "nodejs": + // contentMap["dependencies"] = "package.json" + // case "python": + // contentMap["dependencies"] = "req.txt" + // } + // } + + // splitPath := strings.Split(*fileContent.Path, "/") + // path := strings.TrimSpace(splitPath[0]) + // if path != contentMap["function_name"].(string) { + // // errMsg := fmt.Sprintf("In the repository %s, there was an incompatibility between the function name in the git %s and the function name in the YAML file %s", repo, splitPath[0], contentMap["function_name"].(string)) + // continue + // } + // if strings.Contains(path, "") { + // // errMsg := fmt.Sprintf("In the repository %s, the function name in the yaml %s can't contains spaces", repo, contentMap["function_name"].(string)) + // continue + // } + // + err = validateYamlContent(contentMap) if err != nil { isValidFileYaml = false @@ -139,12 +163,12 @@ func GetGithubContentFromConnectedRepo(connectedRepo map[string]interface{}, fun if isValidFileYaml { fileDetails := functionDetails{ - Content: content, - Commit: commit, - ContentMap: contentMap, - RepoName: repo, - Branch: branch, - Owner: owner, + Commit: commit, + ContentMap: contentMap, + RepoName: repo, + Branch: branch, + Owner: owner, + DirectoryUrl: directoryContent.HTMLURL, } functionsDetails = append(functionsDetails, fileDetails) break From ff1c0d56642d11f4423f153625a27e36a1fea529 Mon Sep 17 00:00:00 2001 From: shohamroditimemphis Date: Fri, 27 Oct 2023 12:46:21 +0300 Subject: [PATCH 2/5] changes --- models/functions.go | 6 +- server/memphis_handlers_functions_cloud.go | 155 ++++++++++-------- server/source_code_management_cloud.go | 6 +- server/source_code_management_github_cloud.go | 4 +- 4 files changed, 96 insertions(+), 75 deletions(-) diff --git a/models/functions.go b/models/functions.go index 411a50ff1..b8886d12c 100644 --- a/models/functions.go +++ b/models/functions.go @@ -34,8 +34,10 @@ type FunctionsResult struct { } type FunctionsRes struct { - Functions []FunctionsResult `json:"functions"` - ScmIntegrated bool `json:"scm_integrated"` + InstallFunctions []FunctionsResult `json:"install_functions"` + OtherFunctions []FunctionsResult `json:"other_functions"` + ScmIntegrated bool `json:"scm_integrated"` + ConnectedRepos []map[string]interface{} `json:"connected_repos"` } type GetFunctionDetails struct { diff --git a/server/memphis_handlers_functions_cloud.go b/server/memphis_handlers_functions_cloud.go index 987d742b2..583ab342f 100644 --- a/server/memphis_handlers_functions_cloud.go +++ b/server/memphis_handlers_functions_cloud.go @@ -50,7 +50,7 @@ func (fh FunctionsHandler) GetAllFunctions(c *gin.Context) { } } - c.IndentedJSON(200, gin.H{"scm_integrated": functionsResult.ScmIntegrated, "other": functionsResult.Functions, "installed": []models.FunctionsRes{}, "connected_repos": []map[string]interface{}{}}) + c.IndentedJSON(200, gin.H{"scm_integrated": functionsResult.ScmIntegrated, "other": functionsResult.OtherFunctions, "installed": functionsResult.InstallFunctions, "connected_repos": functionsResult.ConnectedRepos}) } func (fh FunctionsHandler) GetFunctions(tenantName string) (models.FunctionsRes, error) { @@ -63,11 +63,28 @@ func (fh FunctionsHandler) GetFunctions(tenantName string) (models.FunctionsRes, return models.FunctionsRes{}, err } if len(functions) > 10 { - functions = functions[:10] + functions["install"] = functions["install"][:10] + functions["other"] = functions["other"][:10] } + + installedFunctions := functions["install"] + OtherFunctions := functions["other"] + if len(installedFunctions) == 0 { + installedFunctions = []models.FunctionsResult{} + } + + if len(OtherFunctions) == 0 { + OtherFunctions = []models.FunctionsResult{} + } + + memphisDevFucntions := []map[string]interface{}{} + memphisDevFucntions = append(memphisDevFucntions, memphisFunctions) + allFunctions := models.FunctionsRes{ - Functions: functions, - ScmIntegrated: scmIntegrated, + InstallFunctions: installedFunctions, + OtherFunctions: OtherFunctions, + ScmIntegrated: scmIntegrated, + ConnectedRepos: memphisDevFucntions, } return allFunctions, nil @@ -207,81 +224,83 @@ func getRepoContent(url, accessToken string, body models.GetFunctionDetails) (in return response, nil } -func GetFunctionsDetails(functionsDetails []functionDetails) ([]models.FunctionsResult, error) { - functions := []models.FunctionsResult{} - for _, functionDetails := range functionsDetails { - fucntionContentMap := functionDetails.ContentMap - commit := functionDetails.Commit - link := functionDetails.DirectoryUrl - repo := functionDetails.RepoName - branch := functionDetails.Branch - owner := functionDetails.Owner - tagsInterfaceSlice, ok := fucntionContentMap["tags"].([]interface{}) - tagsStrings := []string{} - if ok { - tagsStrings = make([]string, len(fucntionContentMap["tags"].([]interface{}))) - for i, tag := range tagsInterfaceSlice { - tagMap := tag.(map[interface{}]interface{}) - for _, v := range tagMap { - if str, ok := v.(string); ok { - tagsStrings[i] = str +func GetFunctionsDetails(functionsDetails map[string][]functionDetails) (map[string][]models.FunctionsResult, error) { + functions := map[string][]models.FunctionsResult{} + for key, functionDetails := range functionsDetails { + for _, funcDetailsPerInstalled := range functionDetails { + fucntionContentMap := funcDetailsPerInstalled.ContentMap + commit := funcDetailsPerInstalled.Commit + link := funcDetailsPerInstalled.DirectoryUrl + repo := funcDetailsPerInstalled.RepoName + branch := funcDetailsPerInstalled.Branch + owner := funcDetailsPerInstalled.Owner + tagsInterfaceSlice, ok := fucntionContentMap["tags"].([]interface{}) + tagsStrings := []string{} + if ok { + tagsStrings = make([]string, len(fucntionContentMap["tags"].([]interface{}))) + for i, tag := range tagsInterfaceSlice { + tagMap := tag.(map[interface{}]interface{}) + for _, v := range tagMap { + if str, ok := v.(string); ok { + tagsStrings[i] = str + } } } } - } - var environmentVarsStrings map[string]string - environmentVarsInterfaceSlice, ok := fucntionContentMap["environment_vars"].([]interface{}) - if ok { - environmentVarsStrings = make(map[string]string, len(fucntionContentMap["environment_vars"].([]interface{}))) - for _, environmentVar := range environmentVarsInterfaceSlice { - environmentVarMap := environmentVar.(map[interface{}]interface{}) - for k, v := range environmentVarMap { - if str, ok := v.(string); ok { - environmentVarsStrings[k.(string)] = str + var environmentVarsStrings map[string]string + environmentVarsInterfaceSlice, ok := fucntionContentMap["environment_vars"].([]interface{}) + if ok { + environmentVarsStrings = make(map[string]string, len(fucntionContentMap["environment_vars"].([]interface{}))) + for _, environmentVar := range environmentVarsInterfaceSlice { + environmentVarMap := environmentVar.(map[interface{}]interface{}) + for k, v := range environmentVarMap { + if str, ok := v.(string); ok { + environmentVarsStrings[k.(string)] = str + } } } } - } - description, ok := fucntionContentMap["description"].(string) - if !ok { - description = "" - } + description, ok := fucntionContentMap["description"].(string) + if !ok { + description = "" + } - runtime := fucntionContentMap["runtime"].(string) - regex := regexp.MustCompile(`[0-9]+|\\.$`) - language := regex.ReplaceAllString(runtime, "") - language = strings.TrimRight(language, ".") - if strings.Contains(language, "-edge") { - language = strings.Trim(language, ".-edge") - } + runtime := fucntionContentMap["runtime"].(string) + regex := regexp.MustCompile(`[0-9]+|\\.$`) + language := regex.ReplaceAllString(runtime, "") + language = strings.TrimRight(language, ".") + if strings.Contains(language, "-edge") { + language = strings.Trim(language, ".-edge") + } - byMemphis := false - if repo == memphisDevFunctionsRepoName { - byMemphis = true - } + byMemphis := false + if repo == memphisDevFunctionsRepoName { + byMemphis = true + } - functionDetails := models.FunctionsResult{ - FunctionName: fucntionContentMap["function_name"].(string), - Description: description, - Tags: tagsStrings, - RunTime: runtime, - LastCommit: *commit.Commit.Committer.Date, - Link: link, - Repository: repo, - Branch: branch, - Owner: owner, - Memory: fucntionContentMap["memory"].(int), - Storgae: fucntionContentMap["storage"].(int), - EnvironmentVars: environmentVarsStrings, - Language: language, - ScmType: "github", - InstallInProgress: false, - UpdatesAvailable: false, - ByMemphis: byMemphis, - } + functionDetails := models.FunctionsResult{ + FunctionName: fucntionContentMap["function_name"].(string), + Description: description, + Tags: tagsStrings, + RunTime: runtime, + LastCommit: *commit.Commit.Committer.Date, + Link: link, + Repository: repo, + Branch: branch, + Owner: owner, + Memory: fucntionContentMap["memory"].(int), + Storgae: fucntionContentMap["storage"].(int), + EnvironmentVars: environmentVarsStrings, + Language: language, + ScmType: "github", + InstallInProgress: false, + UpdatesAvailable: false, + ByMemphis: byMemphis, + } - functions = append(functions, functionDetails) + functions[key] = append(functions[key], functionDetails) + } } return functions, nil } diff --git a/server/source_code_management_cloud.go b/server/source_code_management_cloud.go index b721a6185..41f25a6c5 100644 --- a/server/source_code_management_cloud.go +++ b/server/source_code_management_cloud.go @@ -35,7 +35,7 @@ func getSourceCodeDetails(tenantName string, getAllReposSchema interface{}, acti return models.Integration{}, map[string]string{}, nil } -func GetContentOfSelectedRepo(connectedRepo map[string]interface{}, contentDetails []functionDetails) ([]functionDetails, error) { +func GetContentOfSelectedRepo(connectedRepo map[string]interface{}, contentDetails map[string][]functionDetails) (map[string][]functionDetails, error) { var err error contentDetails, err = GetGithubContentFromConnectedRepo(connectedRepo, contentDetails) if err != nil { @@ -55,8 +55,8 @@ func getConnectedSourceCodeRepos(tenantName string) (map[string][]interface{}, b return selectedReposPerSourceCodeIntegration, scmIntegrated } -func GetContentOfSelectedRepos(tenantName string) ([]functionDetails, bool, error) { - contentDetails := []functionDetails{} +func GetContentOfSelectedRepos(tenantName string) (map[string][]functionDetails, bool, error) { + contentDetails := map[string][]functionDetails{} connectedRepos, scmIntegrated := getConnectedSourceCodeRepos(tenantName) var err error for _, connectedRepoPerIntegration := range connectedRepos { diff --git a/server/source_code_management_github_cloud.go b/server/source_code_management_github_cloud.go index 87e35c0e3..5166db90c 100644 --- a/server/source_code_management_github_cloud.go +++ b/server/source_code_management_github_cloud.go @@ -73,7 +73,7 @@ func containsElement(arr []string, val string) bool { return false } -func GetGithubContentFromConnectedRepo(connectedRepo map[string]interface{}, functionsDetails []functionDetails) ([]functionDetails, error) { +func GetGithubContentFromConnectedRepo(connectedRepo map[string]interface{}, functionsDetails map[string][]functionDetails) (map[string][]functionDetails, error) { branch := connectedRepo["branch"].(string) repo := connectedRepo["repo_name"].(string) owner := connectedRepo["repo_owner"].(string) @@ -170,7 +170,7 @@ func GetGithubContentFromConnectedRepo(connectedRepo map[string]interface{}, fun Owner: owner, DirectoryUrl: directoryContent.HTMLURL, } - functionsDetails = append(functionsDetails, fileDetails) + functionsDetails["other"] = append(functionsDetails["other"], fileDetails) break } } From 425e7edbcd36e4be5cb4905c565b956410e8ecb0 Mon Sep 17 00:00:00 2001 From: shohamroditimemphis Date: Fri, 27 Oct 2023 13:36:35 +0300 Subject: [PATCH 3/5] fixes --- models/functions.go | 8 ++++---- server/memphis_handlers_functions_cloud.go | 18 +++++++----------- server/source_code_management_github_cloud.go | 6 +++++- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/models/functions.go b/models/functions.go index b8886d12c..eb5dfe548 100644 --- a/models/functions.go +++ b/models/functions.go @@ -34,10 +34,10 @@ type FunctionsResult struct { } type FunctionsRes struct { - InstallFunctions []FunctionsResult `json:"install_functions"` - OtherFunctions []FunctionsResult `json:"other_functions"` - ScmIntegrated bool `json:"scm_integrated"` - ConnectedRepos []map[string]interface{} `json:"connected_repos"` + InstalledFunctions []FunctionsResult `json:"installed_functions"` + OtherFunctions []FunctionsResult `json:"other_functions"` + ScmIntegrated bool `json:"scm_integrated"` + ConnectedRepos []map[string]interface{} `json:"connected_repos"` } type GetFunctionDetails struct { diff --git a/server/memphis_handlers_functions_cloud.go b/server/memphis_handlers_functions_cloud.go index 583ab342f..165689bc8 100644 --- a/server/memphis_handlers_functions_cloud.go +++ b/server/memphis_handlers_functions_cloud.go @@ -50,7 +50,7 @@ func (fh FunctionsHandler) GetAllFunctions(c *gin.Context) { } } - c.IndentedJSON(200, gin.H{"scm_integrated": functionsResult.ScmIntegrated, "other": functionsResult.OtherFunctions, "installed": functionsResult.InstallFunctions, "connected_repos": functionsResult.ConnectedRepos}) + c.IndentedJSON(200, gin.H{"scm_integrated": functionsResult.ScmIntegrated, "other": functionsResult.OtherFunctions, "installed": functionsResult.InstalledFunctions, "connected_repos": functionsResult.ConnectedRepos}) } func (fh FunctionsHandler) GetFunctions(tenantName string) (models.FunctionsRes, error) { @@ -62,12 +62,8 @@ func (fh FunctionsHandler) GetFunctions(tenantName string) (models.FunctionsRes, if err != nil { return models.FunctionsRes{}, err } - if len(functions) > 10 { - functions["install"] = functions["install"][:10] - functions["other"] = functions["other"][:10] - } - installedFunctions := functions["install"] + installedFunctions := functions["installed"] OtherFunctions := functions["other"] if len(installedFunctions) == 0 { installedFunctions = []models.FunctionsResult{} @@ -81,10 +77,10 @@ func (fh FunctionsHandler) GetFunctions(tenantName string) (models.FunctionsRes, memphisDevFucntions = append(memphisDevFucntions, memphisFunctions) allFunctions := models.FunctionsRes{ - InstallFunctions: installedFunctions, - OtherFunctions: OtherFunctions, - ScmIntegrated: scmIntegrated, - ConnectedRepos: memphisDevFucntions, + InstalledFunctions: installedFunctions, + OtherFunctions: OtherFunctions, + ScmIntegrated: scmIntegrated, + ConnectedRepos: memphisDevFucntions, } return allFunctions, nil @@ -275,7 +271,7 @@ func GetFunctionsDetails(functionsDetails map[string][]functionDetails) (map[str } byMemphis := false - if repo == memphisDevFunctionsRepoName { + if repo == memphisDevFunctionsRepoName && owner == memphisDevFunctionsOwnerName { byMemphis = true } diff --git a/server/source_code_management_github_cloud.go b/server/source_code_management_github_cloud.go index 5166db90c..327370846 100644 --- a/server/source_code_management_github_cloud.go +++ b/server/source_code_management_github_cloud.go @@ -87,7 +87,11 @@ func GetGithubContentFromConnectedRepo(connectedRepo map[string]interface{}, fun return functionsDetails, err } - for _, directoryContent := range repoContent { + for k, directoryContent := range repoContent { + // In order to restrict the api calls per repo + if k == 10 { + break + } if directoryContent.GetType() == "dir" { _, filesContent, _, err := client.Repositories.GetContents(context.Background(), owner, repo, *directoryContent.Path, &github.RepositoryContentGetOptions{ Ref: branch}) From 78c9396a1b9e802242442cd8c4fd9bff164dddaf Mon Sep 17 00:00:00 2001 From: shohamroditimemphis Date: Fri, 27 Oct 2023 15:30:57 +0300 Subject: [PATCH 4/5] fix --- server/source_code_management_github_cloud.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/source_code_management_github_cloud.go b/server/source_code_management_github_cloud.go index 327370846..04428d8b5 100644 --- a/server/source_code_management_github_cloud.go +++ b/server/source_code_management_github_cloud.go @@ -87,9 +87,10 @@ func GetGithubContentFromConnectedRepo(connectedRepo map[string]interface{}, fun return functionsDetails, err } - for k, directoryContent := range repoContent { + countFunctions := 0 + for _, directoryContent := range repoContent { // In order to restrict the api calls per repo - if k == 10 { + if countFunctions == 10 { break } if directoryContent.GetType() == "dir" { @@ -105,6 +106,7 @@ func GetGithubContentFromConnectedRepo(connectedRepo map[string]interface{}, fun var commit *github.RepositoryCommit var contentMap map[string]interface{} if *fileContent.Type == "file" && *fileContent.Name == "memphis.yaml" { + countFunctions++ content, _, _, err = client.Repositories.GetContents(context.Background(), owner, repo, *fileContent.Path, &github.RepositoryContentGetOptions{ Ref: branch}) if err != nil { From d96591c6365c364eb7161797a3ff4168840cdf1e Mon Sep 17 00:00:00 2001 From: shohamroditimemphis Date: Fri, 27 Oct 2023 15:43:32 +0300 Subject: [PATCH 5/5] fix --- server/source_code_management_github_cloud.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/source_code_management_github_cloud.go b/server/source_code_management_github_cloud.go index 04428d8b5..64ba082d0 100644 --- a/server/source_code_management_github_cloud.go +++ b/server/source_code_management_github_cloud.go @@ -106,7 +106,6 @@ func GetGithubContentFromConnectedRepo(connectedRepo map[string]interface{}, fun var commit *github.RepositoryCommit var contentMap map[string]interface{} if *fileContent.Type == "file" && *fileContent.Name == "memphis.yaml" { - countFunctions++ content, _, _, err = client.Repositories.GetContents(context.Background(), owner, repo, *fileContent.Path, &github.RepositoryContentGetOptions{ Ref: branch}) if err != nil { @@ -168,6 +167,7 @@ func GetGithubContentFromConnectedRepo(connectedRepo map[string]interface{}, fun } if isValidFileYaml { + countFunctions++ fileDetails := functionDetails{ Commit: commit, ContentMap: contentMap,