Skip to content

Commit 6f1eef8

Browse files
committed
fix no workflow metrics
Signed-off-by: Markus Blaschke <[email protected]>
1 parent dbfb412 commit 6f1eef8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

metrics_github_workflows.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ func (m *MetricsCollectorGithubWorkflows) getRepoList(org string) ([]*github.Rep
112112
}
113113

114114
for {
115+
m.Logger().Debugf(`fetching repository list with page "%d"`, opts.Page)
116+
115117
result, response, err := githubClient.Repositories.ListByOrg(m.Context(), org, &opts)
116118
var ghRateLimitError *github.RateLimitError
117119
if ok := errors.As(err, &ghRateLimitError); ok {
@@ -140,6 +142,8 @@ func (m *MetricsCollectorGithubWorkflows) getRepoWorkflows(org, repo string) ([]
140142
opts := github.ListOptions{PerPage: 100, Page: 1}
141143

142144
for {
145+
m.Logger().Debugf(`fetching workflows list for repo "%s" with page "%d"`, repo, opts.Page)
146+
143147
result, response, err := githubClient.Actions.ListWorkflows(m.Context(), org, repo, &opts)
144148
var ghRateLimitError *github.RateLimitError
145149
if ok := errors.As(err, &ghRateLimitError); ok {
@@ -209,8 +213,6 @@ func (m *MetricsCollectorGithubWorkflows) Collect(callback chan<- func()) {
209213
}
210214

211215
for _, repo := range repositories {
212-
var workflowRuns []*github.WorkflowRun
213-
214216
repositoryMetric.AddInfo(prometheus.Labels{
215217
"org": org,
216218
"repo": repo.GetName(),
@@ -237,7 +239,7 @@ func (m *MetricsCollectorGithubWorkflows) Collect(callback chan<- func()) {
237239
})
238240
}
239241

240-
if len(workflowRuns) >= 1 {
242+
if len(workflows) >= 1 {
241243
workflowRuns, err := m.getRepoWorkflowRuns(repo)
242244
if err != nil {
243245
panic(err)

0 commit comments

Comments
 (0)