This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new bcc3c5f21 fix(github-plugin): removes the processed org check to 
return all the org repos, and pulls the repository data when adding scope 
(#8088)
bcc3c5f21 is described below

commit bcc3c5f2132433e3c07c4925ba8ea1d7d6180770
Author: Peter <[email protected]>
AuthorDate: Sun Sep 22 23:27:55 2024 -0400

    fix(github-plugin): removes the processed org check to return all the org 
repos, and pulls the repository data when adding scope (#8088)
    
    previous behavior would return a single repository. Also no repo data was 
returned so the user could not add the repo to devlake
    
    fixes part of my issue in #7655
---
 backend/plugins/github/api/remote_api.go | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/backend/plugins/github/api/remote_api.go 
b/backend/plugins/github/api/remote_api.go
index 4044a1d70..4d9db29c5 100644
--- a/backend/plugins/github/api/remote_api.go
+++ b/backend/plugins/github/api/remote_api.go
@@ -202,18 +202,25 @@ func listGithubAppInstalledRepos(
        }
        var appRepos GithubAppRepo
        errors.Must(api.UnmarshalResponse(resApp, &appRepos))
-       processedOrgs := make(map[string]struct{})
        for _, r := range appRepos.Repositories {
                orgName := r.Owner.Login
-               if _, exists := processedOrgs[orgName]; !exists && orgName != 
"" {
+               if orgName != "" {
                        children = append(children, 
dsmodels.DsRemoteApiScopeListEntry[models.GithubRepo]{
                                Type:     api.RAS_ENTRY_TYPE_SCOPE,
                                ParentId: &orgName,
                                Id:       fmt.Sprintf("%v", r.ID),
                                Name:     fmt.Sprintf("%v", r.Name),
                                FullName: fmt.Sprintf("%v", r.FullName),
+                               Data: &models.GithubRepo{
+                                       GithubId:    r.ID,
+                                       Name:        r.Name,
+                                       FullName:    r.FullName,
+                                       HTMLUrl:     r.HTMLURL,
+                                       Description: r.Description,
+                                       OwnerId:     r.Owner.ID,
+                                       CloneUrl:    r.CloneURL,
+                               },
                        })
-                       processedOrgs[orgName] = struct{}{}
                }
        }
        if len(appRepos.Repositories) == page.PerPage {

Reply via email to