Documentation
¶
Overview ¶
Package github provides GitHub API client integration for aqua. It handles release artifact downloading, GitHub authentication management, API rate limiting, and fetching releases and tags. This package abstracts the complexity of interacting with GitHub's API and provides a clean interface for downloading CLI tools hosted on GitHub repositories.
Index ¶
- Constants
- func MakeRetryable(client *http.Client, logger *slog.Logger) *http.Client
- func NewGhtknTokenSource(logger *slog.Logger) (oauth2.TokenSource, error)
- func NewKeyringTokenSource(logger *slog.Logger) oauth2.TokenSource
- type ArchiveFormat
- type ListOptions
- type MockRepositoriesService
- func (m *MockRepositoriesService) DownloadContents(ctx context.Context, owner, repo, filepath string, ...) (io.ReadCloser, *github.Response, error)
- func (m *MockRepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repoName string, assetID int64, ...) (io.ReadCloser, string, error)
- func (m *MockRepositoriesService) Get(ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error)
- func (m *MockRepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat github.ArchiveFormat, ...) (*url.URL, *github.Response, error)
- func (m *MockRepositoriesService) GetLatestRelease(ctx context.Context, repoOwner, repoName string) (*github.RepositoryRelease, *github.Response, error)
- func (m *MockRepositoriesService) GetReleaseByTag(ctx context.Context, owner, repoName, version string) (*github.RepositoryRelease, *github.Response, error)
- func (m *MockRepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opts *github.ListOptions) ([]*github.ReleaseAsset, *github.Response, error)
- func (m *MockRepositoriesService) ListReleases(ctx context.Context, owner, repo string, opts *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error)
- func (m *MockRepositoriesService) ListTags(ctx context.Context, owner string, repo string, opts *github.ListOptions) ([]*github.RepositoryTag, *github.Response, error)
- type ReleaseAsset
- type RepositoriesService
- type Repository
- type RepositoryContent
- type RepositoryContentGetOptions
- type RepositoryRelease
- type RepositoryTag
- type Response
Constants ¶
const Tarball = github.Tarball
Variables ¶
This section is empty.
Functions ¶
func MakeRetryable ¶ added in v2.53.0
func NewGhtknTokenSource ¶ added in v2.66.1
func NewGhtknTokenSource(logger *slog.Logger) (oauth2.TokenSource, error)
NewGhtknTokenSource returns a token source getting a GitHub access token from ghtkn. It returns nil if ghtkn isn't enabled.
func NewKeyringTokenSource ¶ added in v2.66.1
func NewKeyringTokenSource(logger *slog.Logger) oauth2.TokenSource
NewKeyringTokenSource returns a token source getting a GitHub access token from the keyring. It returns nil if the keyring isn't enabled.
Types ¶
type ArchiveFormat ¶
type ArchiveFormat = github.ArchiveFormat
type ListOptions ¶
type ListOptions = github.ListOptions
type MockRepositoriesService ¶
type MockRepositoriesService struct {
Releases []*github.RepositoryRelease
Content string
Repo *github.Repository
Tags []*github.RepositoryTag
Asset string
Assets []*github.ReleaseAsset
URL *url.URL
}
func (*MockRepositoriesService) DownloadContents ¶ added in v2.23.2
func (m *MockRepositoriesService) DownloadContents(ctx context.Context, owner, repo, filepath string, opts *github.RepositoryContentGetOptions) (io.ReadCloser, *github.Response, error)
func (*MockRepositoriesService) DownloadReleaseAsset ¶
func (*MockRepositoriesService) Get ¶
func (m *MockRepositoriesService) Get(ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error)
func (*MockRepositoriesService) GetArchiveLink ¶
func (m *MockRepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat github.ArchiveFormat, opts *github.RepositoryContentGetOptions, maxRedirects int) (*url.URL, *github.Response, error)
func (*MockRepositoriesService) GetLatestRelease ¶
func (m *MockRepositoriesService) GetLatestRelease(ctx context.Context, repoOwner, repoName string) (*github.RepositoryRelease, *github.Response, error)
func (*MockRepositoriesService) GetReleaseByTag ¶
func (m *MockRepositoriesService) GetReleaseByTag(ctx context.Context, owner, repoName, version string) (*github.RepositoryRelease, *github.Response, error)
func (*MockRepositoriesService) ListReleaseAssets ¶
func (m *MockRepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opts *github.ListOptions) ([]*github.ReleaseAsset, *github.Response, error)
func (*MockRepositoriesService) ListReleases ¶
func (m *MockRepositoriesService) ListReleases(ctx context.Context, owner, repo string, opts *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error)
func (*MockRepositoriesService) ListTags ¶
func (m *MockRepositoriesService) ListTags(ctx context.Context, owner string, repo string, opts *github.ListOptions) ([]*github.RepositoryTag, *github.Response, error)
type ReleaseAsset ¶
type ReleaseAsset = github.ReleaseAsset
type RepositoriesService ¶
type RepositoriesService = github.RepositoriesService
type Repository ¶
type Repository = github.Repository
type RepositoryContent ¶
type RepositoryContent = github.RepositoryContent
type RepositoryContentGetOptions ¶
type RepositoryContentGetOptions = github.RepositoryContentGetOptions
type RepositoryRelease ¶
type RepositoryRelease = github.RepositoryRelease
type RepositoryTag ¶
type RepositoryTag = github.RepositoryTag