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 ¶
- func SplitName(name string) (parts [2]string, err error)
- type GitHub
- func (g *GitHub) Exe() error
- func (g *GitHub) Export() error
- func (g *GitHub) Get(attribute string) string
- func (g *GitHub) Initialize(name string) error
- func (g *GitHub) Install(d common.InstallData) (output string, found file.File, err error)
- func (g *GitHub) LatestVersion() (string, error)
- func (g *GitHub) LatestVersionFromExport() (string, error)
- func (g *GitHub) MatchAssetsToRequirements(_ []string, version string, requirements match.Requirements) (string, error)
- func (g *GitHub) Path(_ string, extensions []string, version string, requirements match.Requirements) error
- func (g *GitHub) PopulateOwnerAndRepo(name string) error
- func (g *GitHub) Version(_ string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GitHub ¶
type GitHub struct {
Repo string
Owner string
Token string `mask:"fixed"`
// Data holds additional metadata related to the repository.
Data common.Metadata `yaml:"-"`
// contains filtered or unexported fields
}
GitHub represents a GitHub repository with optional authentication token and metadata.
func (*GitHub) Initialize ¶
Initialize populates the GitHub repository's owner and name from the given input.
func (*GitHub) Install ¶
Install downloads the asset from GitHub and returns the output, the found file, and any error encountered.
func (*GitHub) LatestVersion ¶
LatestVersion fetches the latest release version of the GitHub repository.
func (*GitHub) LatestVersionFromExport ¶
LatestVersionFromExport fetches the latest release version from the exported file.
func (*GitHub) MatchAssetsToRequirements ¶
func (g *GitHub) MatchAssetsToRequirements( _ []string, version string, requirements match.Requirements, ) (string, error)
MatchAssetsToRequirements matches release assets to specific file extensions and requirements, returning the URL of the matched asset.
func (*GitHub) Path ¶
func (g *GitHub) Path(_ string, extensions []string, version string, requirements match.Requirements) error
Path sets the download URL of the matched asset in the metadata, based on version, file extensions, and requirements.
func (*GitHub) PopulateOwnerAndRepo ¶
PopulateOwnerAndRepo sets the Owner and Repo fields based on the given name. If Owner and Repo are already set, this method does nothing.