Skip to content

Commit

Permalink
🧹 improve github org discovery (#4590)
Browse files Browse the repository at this point in the history
- by default the org is scanned when user uses `scan github org <gh-org>`
- skip org scan if `--repos` is uses
- skip org scan if `scan github org <gh-org> --discover repos` is used
  • Loading branch information
chris-rock authored Aug 27, 2024
1 parent 96abf9c commit faad26f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion providers/github/resources/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit faad26f

Please sign in to comment.