Skip to content

Commit

Permalink
fix: panic with inner client (#714)
Browse files Browse the repository at this point in the history
related to this thread in slack:
https://chainguard-dev.slack.com/archives/C02SD39C6BW/p1738862337902599

---------

Signed-off-by: hectorj2f <hector@chainguar.dev>
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
Co-authored-by: hectorj2f <hector@chainguar.dev>
  • Loading branch information
hectorj2f and hectorj2f authored Feb 7, 2025
1 parent 31462d4 commit 83fff68
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions modules/github-bots/sdk/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func NewGitHubClient(ctx context.Context, org, repo, policyName string, opts ...
})

client := GitHubClient{
inner: github.NewClient(oauth2.NewClient(ctx, ts)),
ts: ts,
bufSize: 1024 * 1024, // 1MB buffer for requests
org: org,
Expand All @@ -50,11 +51,6 @@ func NewGitHubClient(ctx context.Context, org, repo, policyName string, opts ...
opt(&client)
}

// if client has not been configured withOpts then create a new client
if client.inner == nil {
client.inner = github.NewClient(oauth2.NewClient(ctx, ts))
}

return client
}

Expand Down
1 change: 1 addition & 0 deletions modules/github-bots/sdk/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func TestGitHubClientConfiguration(t *testing.T) {
"test-org",
"test-repo",
"test-policy",
WithSecondaryRateLimitWaiter(),
WithClient(testClient),
)

Expand Down

0 comments on commit 83fff68

Please sign in to comment.