(fix) validation to ensure only one of --org or --repo is provided for Github source (#4141)

* validation to ensure only one of --org or --repo is provided fro github source

* position swap of variables.
updated the message.
This commit is contained in:
Abdul Basit
2025-06-10 13:19:21 -05:00
committed by GitHub
parent bb506f63a1
commit f649faafce
+3
View File
@@ -734,6 +734,9 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
if len(*githubScanOrgs) == 0 && len(*githubScanRepos) == 0 {
return scanMetrics, fmt.Errorf("invalid config: you must specify at least one organization or repository")
}
if len(*githubScanOrgs) > 0 && len(*githubScanRepos) > 0 {
return scanMetrics, fmt.Errorf("invalid config: you cannot specify both organizations and repositories at the same time")
}
cfg := sources.GithubConfig{
Endpoint: *githubScanEndpoint,