diff --git a/assets/config.yaml b/assets/config.yaml index c26b138..70e7c07 100644 --- a/assets/config.yaml +++ b/assets/config.yaml @@ -21,6 +21,7 @@ global: name: "Hyperledger Labs" github: "hyperledger-labs" scrape-duration-days: 7 + scrape-repo-class: public external-template: enabled: false # Possible values "repository" diff --git a/cmd/main.go b/cmd/main.go index f360da4..6461cbb 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -372,7 +372,7 @@ func getExpectedReportsLists( for _, organization := range config.GlobalConfiguration.Organizations { - repos, err := client.ListRepositories(organization.Organization.Github) + repos, err := client.ListRepositories(organization.Organization.Github, config.GlobalConfiguration.RepoClass) if err != nil { log.Fatalf("Err: %v", err) return nil, nil, nil, true diff --git a/internal/pkg/client/client.go b/internal/pkg/client/client.go index a2fb4bc..279a620 100644 --- a/internal/pkg/client/client.go +++ b/internal/pkg/client/client.go @@ -20,7 +20,7 @@ import "github-updates/internal/pkg/configs" // GHClientInterface is for testing type GHClientInterface interface { - ListRepositories(string) ([]string, error) + ListRepositories(string, string) ([]string, error) ListPRs(string, []string, int) ([]configs.PrList, error) ListReleases(string, []string, int) ([]configs.ReleaseList, error) IssueWithLabels(string, []string, []string, int) ([]configs.IssueList, error) diff --git a/internal/pkg/client/ghclient.go b/internal/pkg/client/ghclient.go index a9b481e..49d341e 100644 --- a/internal/pkg/client/ghclient.go +++ b/internal/pkg/client/ghclient.go @@ -55,12 +55,13 @@ func NewClient() GHClientInterface { } // ListRepositories returns the list of all repositories -func (c Client) ListRepositories(org string) ([]string, error) { +func (c Client) ListRepositories(org string, repoClass string) ([]string, error) { var listOfRepositories []string listOption := &github.RepositoryListByOrgOptions{ ListOptions: github.ListOptions{ PerPage: 20, }, + Type: repoClass, } for { repositories, response, err := diff --git a/internal/pkg/configs/configuration.go b/internal/pkg/configs/configuration.go index 5c86148..57e100d 100644 --- a/internal/pkg/configs/configuration.go +++ b/internal/pkg/configs/configuration.go @@ -66,6 +66,7 @@ type GlobalConfiguration struct { Organizations []Organization `yaml:"organizations"` DaysCount int `yaml:"scrape-duration-days"` ExternalTemplate ExternalTemplate `yaml:"external-template"` + RepoClass string `yaml:"scrape-repo-class"` } type ExternalTemplate struct {