From 813b3a52f3ce910704e9e819ebe011ea8dfbb4bb Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Wed, 21 Aug 2024 23:18:51 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20improve=20github=20org=20discove?= =?UTF-8?q?ry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - by default the org is scanned when user uses `scan github org ` - skip org scan if `--repos` is uses - skip org scan if `scan github org --discover repos` is used --- providers/github/resources/discovery.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/providers/github/resources/discovery.go b/providers/github/resources/discovery.go index f42f0914aa..1795c08a10 100644 --- a/providers/github/resources/discovery.go +++ b/providers/github/resources/discovery.go @@ -104,7 +104,9 @@ func org(runtime *plugin.Runtime, orgName string, conn *connection.GithubConnect return nil, err } - if reposFilter.empty() { + // only scan the org if the discover flag is provided, this allows you to scan all repos in an org with simply using + // --discover repos. If users provide a repo filter, we also want to skip org scan. + if stringx.ContainsAnyOf(targets, connection.DiscoveryOrganization, connection.DiscoveryAll, connection.DiscoveryAuto) && reposFilter.empty() { assetList = append(assetList, &inventory.Asset{ PlatformIds: []string{connection.NewGithubOrgIdentifier(org.Login.Data)}, Name: org.Name.Data,