From c78ba30edfdb9b1dd827b84ac504bc24687eda73 Mon Sep 17 00:00:00 2001 From: Christian Zunker <827818+czunker@users.noreply.github.com> Date: Mon, 25 Sep 2023 16:29:33 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20GitHub=20org=20name=20(#18?= =?UTF-8?q?82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 Fix GitHub org name Fixes #1858 Signed-off-by: Christian Zunker * Fix org id for org discovery Signed-off-by: Christian Zunker * Fix repo asset name for discovery Signed-off-by: Christian Zunker --------- Signed-off-by: Christian Zunker --- providers/github/resources/discovery.go | 6 +++--- providers/github/resources/github_org.go | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/providers/github/resources/discovery.go b/providers/github/resources/discovery.go index 9542ce552b..c433d114c5 100644 --- a/providers/github/resources/discovery.go +++ b/providers/github/resources/discovery.go @@ -95,7 +95,7 @@ func org(runtime *plugin.Runtime, orgName string, conn *connection.GithubConnect return nil, err } assetList = append(assetList, &inventory.Asset{ - PlatformIds: []string{connection.NewGithubOrgIdentifier(org.Name.Data)}, + PlatformIds: []string{connection.NewGithubOrgIdentifier(org.Login.Data)}, Name: org.Name.Data, Platform: connection.GithubOrgPlatform, Labels: map[string]string{}, @@ -108,8 +108,8 @@ func org(runtime *plugin.Runtime, orgName string, conn *connection.GithubConnect for i := range org.GetRepositories().Data { repo := org.GetRepositories().Data[i].(*mqlGithubRepository) assetList = append(assetList, &inventory.Asset{ - PlatformIds: []string{connection.NewGitHubRepoIdentifier(org.Name.Data, repo.Name.Data)}, - Name: org.Name.Data + "/" + repo.Name.Data, + PlatformIds: []string{connection.NewGitHubRepoIdentifier(org.Login.Data, repo.Name.Data)}, + Name: org.Login.Data + "/" + repo.Name.Data, Platform: connection.GithubRepoPlatform, Labels: make(map[string]string), Connections: []*inventory.Config{cloneInventoryConf(conn.Conf)}, diff --git a/providers/github/resources/github_org.go b/providers/github/resources/github_org.go index c4c6409fcd..dd710c279a 100644 --- a/providers/github/resources/github_org.go +++ b/providers/github/resources/github_org.go @@ -37,11 +37,13 @@ func initGithubOrganization(runtime *plugin.Runtime, args map[string]*llx.RawDat } var name string - if x, ok := args["name"]; ok { - name = x.Value.(string) + if org.Name != nil { + name = *org.Name } if name == "" { - name = *org.Name + if x, ok := args["name"]; ok { + name = x.Value.(string) + } } args["id"] = llx.IntDataPtr(org.ID) args["name"] = llx.StringData(name)