github

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	KeyAppID             = "githubAppID"
	KeyAppInstallationID = "githubAppInstallationID"
	KeyAppPrivateKey     = "githubAppPrivateKey"
	KeyAppBaseURL        = "githubAppBaseURL"

	AccessTokenUsername = "x-access-token"
)

Variables

This section is empty.

Functions

func GetCredentials added in v0.31.0

func GetCredentials(ctx context.Context, opts ...OptFunc) (string, string, error)

GetCredentials returns the GitHub App installation username and password for authenticating Git operations.

Types

type AppToken

type AppToken struct {
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expires_at"`
}

AppToken contains a GitHub App installation token and its expiry.

func (*AppToken) GetDuration

func (at *AppToken) GetDuration() time.Duration

GetDuration returns the duration until the token expires.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an authentication provider for GitHub Apps.

func New

func New(opts ...OptFunc) (*Client, error)

New returns a new authentication provider for GitHub Apps.

func (*Client) GetToken

func (p *Client) GetToken(ctx context.Context) (*AppToken, error)

GetToken returns the token that can be used to authenticate as a GitHub App installation. Ref: https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation

type OptFunc

type OptFunc func(*Client)

OptFunc enables specifying options for the provider.

func WithAppData

func WithAppData(appData map[string][]byte) OptFunc

WithAppData configures the client using data from a map

func WithCache

func WithCache(cache *cache.TokenCache, kind, name, namespace, operation string) OptFunc

WithCache sets the token cache and the object involved in the operation for recording cache events.

func WithProxyURL

func WithProxyURL(proxyURL *url.URL) OptFunc

WithProxyURL sets the proxy URL to use with the transport.

func WithTLSConfig added in v0.35.0

func WithTLSConfig(tlsConfig *tls.Config) OptFunc

WithTLSConfig sets the tls config to use with the transport.

Jump to

Keyboard shortcuts

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