Documentation
¶
Overview ¶
Package github provides functionality for interacting with GitHub repositories, including fetching release information, matching assets to specific requirements, and downloading files from repository releases. It supports authentication via GitHub tokens and provides utility functions for handling repository data.
Index ¶
- type GitHub
- func (g *GitHub) Get(attribute string) string
- func (g *GitHub) Initialize(name string) error
- func (g *GitHub) Install(d install.Data, progressListener getter.ProgressTracker) (output string, found file.File, err error)
- func (g *GitHub) LatestVersion(ctx context.Context, version string) (string, error)
- func (g *GitHub) MatchAssetsToRequirements(ctx context.Context, _ []string, version string, ...) (string, error)
- func (g *GitHub) PopulateOwnerAndRepo(name string) (err error)
- func (g *GitHub) URL(_ string, extensions []string, version string, requirements match.Requirements) error
- func (g *GitHub) Version(version string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitHub ¶
type GitHub struct {
Data install.Metadata `mapstructure:"-" yaml:"-"`
Repo string `mapstructure:"repo" yaml:"repo"`
Owner string `mapstructure:"owner" yaml:"owner"`
Token string `mapstructure:"token" mask:"fixed" yaml:"token"`
Pre bool `mapstructure:"pre" yaml:"pre"`
// contains filtered or unexported fields
}
GitHub represents a GitHub repository configuration and state.
func (*GitHub) Initialize ¶
Initialize sets up the GitHub repository configuration from the given name. Returns an error if the repository name format is invalid.
func (*GitHub) Install ¶
func (g *GitHub) Install( d install.Data, progressListener getter.ProgressTracker, ) (output string, found file.File, err error)
Install downloads the GitHub release asset using the provided configuration. Returns the operation output, downloaded file information, and any errors.
func (*GitHub) LatestVersion ¶
LatestVersion fetches the latest release version from GitHub. Returns the tag name of the latest release, respecting the Pre flag setting.
func (*GitHub) MatchAssetsToRequirements ¶
func (g *GitHub) MatchAssetsToRequirements( ctx context.Context, _ []string, version string, requirements match.Requirements, ) (string, error)
MatchAssetsToRequirements finds release assets matching the given requirements. Returns the download URL of the best matching asset, considering platform, architecture, and other specified requirements.
func (*GitHub) PopulateOwnerAndRepo ¶
PopulateOwnerAndRepo sets the Owner and Repo fields from a name string. Expects name in "owner/repo" format if fields are not already set. Returns an error if the format is invalid or fields are partially set.