github

package
v1.6.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package github contains all logic for implementing Github credential pooling

Description: Implements a static token transport for use in rate limit validation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetToken

func GetToken(ctx context.Context, creds []*Credential, logger logrus.FieldLogger) (cfg.SecretData, error)

GetToken returns a Github Token that is not rate-limited from a pool of Github Apps and Access Tokens.

Types

type Credential

type Credential struct {
	// Name is an optional field to supply to make it easier to identify a
	// set of credentials
	Name string

	// AppID is the ID of the Github App that this credential is tied to.
	// If this is set then PEM must also be set.
	AppID *int

	// InstallID is the install ID of the AppID provided above. Must be set
	// when AppID is set.
	InstallID *int

	// PEM is the private key of the Github App that this credential is
	// tied to. This should not be provided if AppID is 0.
	PEM cfg.SecretData

	// AccessToken is a Github Personal Access Token to be used. This must
	// be set if AppID is not set.
	AccessToken cfg.SecretData
}

Credential is a type of credential to use when talking to Github

func (*Credential) GetToken

func (c *Credential) GetToken(ctx context.Context) (cfg.SecretData, error)

GetToken returns a valid token from a credential and ensures it's not rate-limited if it is, or one cannot be obtained, then instead an error is returned.

type RateLimitError added in v1.6.14

type RateLimitError struct {
	Rate *gc.Rate
}

RateLimitError is an `error` which also provides rate limit metadata.

func (RateLimitError) Error added in v1.6.14

func (r RateLimitError) Error() string

Error implements the `error` interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL