Skip to content

Commit bf80c82

Browse files
committed
ignore disabled repositories
fixes #43 Signed-off-by: Markus Blaschke <[email protected]>
1 parent 9ad76dd commit bf80c82

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

azure-devops-client/repository.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ type Repository struct {
2222
Visibility string
2323
Size int64
2424

25+
IsDisabled *bool `json:"isDisabled"`
26+
2527
Links Links `json:"_links"`
2628
}
2729

@@ -128,3 +130,11 @@ func (c *AzureDevopsClient) ListPushes(project string, repository string, fromDa
128130

129131
return
130132
}
133+
134+
func (r *Repository) Disabled() (ret bool) {
135+
if r.IsDisabled != nil {
136+
return *r.IsDisabled
137+
}
138+
139+
return false
140+
}

metrics_pullrequest.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ func (m *MetricsCollectorPullRequest) Reset() {
8282

8383
func (m *MetricsCollectorPullRequest) Collect(ctx context.Context, logger *log.Entry, callback chan<- func(), project devopsClient.Project) {
8484
for _, repository := range project.RepositoryList.List {
85+
if repository.Disabled() {
86+
continue
87+
}
88+
8589
contextLogger := logger.WithField("repository", repository.Name)
8690
m.collectPullRequests(ctx, contextLogger, callback, project, repository)
8791
}

metrics_repository.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ func (m *MetricsCollectorRepository) Collect(ctx context.Context, logger *log.En
8585
wg := sync.WaitGroup{}
8686

8787
for _, repository := range project.RepositoryList.List {
88+
if repository.Disabled() {
89+
continue
90+
}
91+
8892
wg.Add(1)
8993
go func(ctx context.Context, callback chan<- func(), project devopsClient.Project, repository devopsClient.Repository) {
9094
defer wg.Done()

0 commit comments

Comments
 (0)