Skip to content

Commit

Permalink
Logging GitHub API Rate Limit
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Hybner <[email protected]>
  • Loading branch information
Lukas Hybner committed Oct 3, 2022
1 parent 13c5d22 commit 5f7beae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controllers/githubapi/runnerapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package githubapi

import (
"context"
"github.com/go-logr/logr"
"github.com/google/go-github/v47/github"
"github.com/gregjones/httpcache"
"github.com/palantir/go-githubapp/githubapp"
Expand Down Expand Up @@ -57,6 +58,7 @@ func (r runnerAPI) getClient(ctx context.Context, organization string, token str

// Return all runners for the org
func (r runnerAPI) GetRunners(ctx context.Context, organization string, repository string, token string) ([]*github.Runner, error) {
logger := logr.FromContextOrDiscard(ctx)
client, err := r.getClient(ctx, organization, token)
if err != nil {
return nil, err
Expand All @@ -78,6 +80,7 @@ func (r runnerAPI) GetRunners(ctx context.Context, organization string, reposito
if err != nil {
return allRunners, err
}
logger.Info("GerRunners GitHub Api Rate limit", "Rate", response.Rate)
allRunners = append(allRunners, runners.Runners...)
if response.NextPage == 0 {
break
Expand Down

0 comments on commit 5f7beae

Please sign in to comment.