diff --git a/internal/tools/gittar/conf/conf.go b/internal/tools/gittar/conf/conf.go index 78ad0e78094..abd664e20d5 100644 --- a/internal/tools/gittar/conf/conf.go +++ b/internal/tools/gittar/conf/conf.go @@ -61,6 +61,7 @@ type Conf struct { // metrics RefreshPersonalContributorDuration time.Duration `default:"12h" env:"REFRESH_PERSONAL_CONTRIBUTOR_DURATION"` + PersonalContributionOrgIDWhiteList []uint64 `env:"PERSONAL_CONTRIBUTION_ORG_ID_WHITE_LIST"` MetricTargetBranches []string `env:"METRIC_TARGET_BRANCHES" default:"[\"master\",\"main\",\"dev\",\"develop\",\"release\",\"feature/develop\"]"` // AI @@ -216,6 +217,10 @@ func RefreshPersonalContributorDuration() time.Duration { return cfg.RefreshPersonalContributorDuration } +func PersonalContributionOrgIDWhiteList() []uint64 { + return cfg.PersonalContributionOrgIDWhiteList +} + func MetricTargetBranches() []string { return cfg.MetricTargetBranches } diff --git a/internal/tools/gittar/metrics/collector.go b/internal/tools/gittar/metrics/collector.go index 1f6323ee2c9..b754557aa82 100644 --- a/internal/tools/gittar/metrics/collector.go +++ b/internal/tools/gittar/metrics/collector.go @@ -129,10 +129,14 @@ func (c *Collector) RefreshPersonalContributions() error { now := time.Now() start := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local) end := time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 0, time.Local) - contributions, err := c.IterateRepos(apistructs.GittarListRepoRequest{ + req := apistructs.GittarListRepoRequest{ Start: &start, End: &end, - }) + } + if len(conf.PersonalContributionOrgIDWhiteList()) > 0 { + req.OrgIDs = conf.PersonalContributionOrgIDWhiteList() + } + contributions, err := c.IterateRepos(req) if err != nil { return err }