Authenticate GitHub API call in K8s version discovery#22740
Authenticate GitHub API call in K8s version discovery#22740manusa wants to merge 1 commit intokubernetes:masterfrom
Conversation
IsInGitHubKubernetesVersions creates an unauthenticated GitHub client, which causes rate-limit errors (HTTP 403) when running minikube within a GitHub Action where GITHUB_TOKEN is available. Reuse the existing oauth2 pattern from pkg/minikube/download/gh/gh.go so that the client respects the GITHUB_TOKEN environment variable. A follow-up refactor could export a shared NewClient helper from pkg/minikube/download/gh to avoid duplicating the oauth2 wiring. Signed-off-by: Marc Nuri <marc@marcnuri.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: manusa The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @manusa. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Can one of the admins verify this patch? |
Summary
IsInGitHubKubernetesVersionscreates an unauthenticated GitHub client, which causesrate-limit errors (HTTP 403) when running minikube within a GitHub Action where
GITHUB_TOKENis available.This change reuses the existing oauth2 pattern from
pkg/minikube/download/gh/gh.goso that the client respects the
GITHUB_TOKENenvironment variable, falling back toan unauthenticated client when no token is set.
Changes
newGitHubClientpackage-level variablefor testability (same pattern used in
cmd/minikube/cmd/delete.go,cmd/minikube/cmd/start.go, etc.)GITHUB_TOKENwith oauth2 when available (same wiring asgh.go)Follow-up
A cleaner refactor could export a shared
NewClienthelper frompkg/minikube/download/ghto avoid duplicating the oauth2 wiring across packages.Would this be a welcome change? Happy to send a follow-up PR if so.