From cdc8ba12be824cb8ad69d3614b759ac2a19b869a Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Thu, 23 Oct 2025 11:23:16 -0400 Subject: [PATCH] Only set `Authorization` when `token` is available --- github/github.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/github/github.go b/github/github.go index bf17933207c..5dffac1971d 100644 --- a/github/github.go +++ b/github/github.go @@ -354,7 +354,9 @@ func (c *Client) WithAuthToken(token string) *Client { c2.client.Transport = roundTripperFunc( func(req *http.Request) (*http.Response, error) { req = req.Clone(req.Context()) - req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", token)) + if token != "" { + req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", token)) + } return transport.RoundTrip(req) }, )