Documentation
¶
Index ¶
Constants ¶
const ( // MaxRetries is how many times a retryable response is sent again. MaxRetries = 5 // DefaultTimeout is how long one attempt waits for GitHub to answer. // The wait between attempts is outside this deadline. DefaultTimeout = 30 * time.Second )
Variables ¶
var ErrAuthTimedOut = errors.New("github auth timed out")
ErrAuthTimedOut is returned when `gh auth token` does not finish within ghAuthTimeout.
ErrAuthUnavailable is returned when neither GITHUB_TOKEN nor gh CLI auth is available.
Functions ¶
func New ¶
New returns a GitHub API client. An empty token sends requests without a bearer token. An empty baseURL uses https://api.github.com/ and https://uploads.github.com/. Any other absolute http or https baseURL keeps uploads on that same host, under /api/uploads/. Each attempt waits DefaultTimeout. A 429 or 5xx is retried up to MaxRetries times, as is a primary or secondary rate limit. Retry-After is the wait when GitHub sends a positive number of seconds. A primary limit waits until X-RateLimit-Reset, a Unix timestamp. Either of those waits is capped at one hour. While a request waits out a Retry-After, every other request through the client waits with it. Otherwise a spent primary limit, marked by X-RateLimit-Remaining 0, or a 5xx holds only its own request, and a secondary rate limit or a 429 holds every request. A client timeout returns an error that wraps errors.ErrTimeout and does not include the request URL.
func ResolveToken ¶
Types ¶
This section is empty.