Documentation
¶
Index ¶
- Variables
- func IsGithubHost(host string) bool
- func IsGithubRepo(repoURL string) bool
- func ParseGitHubRepoURL(repoURL string) (owner, repo string, ok bool)
- func RepoHost(repoURL string) string
- func ResolveGitRepoRevision(ctx context.Context, client GitClient, repoURL string, ...) (models.GitRepoRevision, error)
- type GitClient
- type GitCredentials
- type RepoResult
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func IsGithubHost ¶
func ParseGitHubRepoURL ¶
ParseGitHubRepoURL extracts owner and repo from a GitHub URL. Handles HTTPS, SSH, and SCP-style URLs (git@github.com:owner/repo.git). Returns false if the URL is not a GitHub repo.
func RepoHost ¶
RepoHost extracts the host (without port) from any git repository URL — https, ssh://, or scp-style (git@host:org/repo) — falling back to the raw URL when it cannot be parsed.
func ResolveGitRepoRevision ¶
func ResolveGitRepoRevision(ctx context.Context, client GitClient, repoURL string, rev models.GitRepoRevision) (models.GitRepoRevision, error)
ResolveGitRepoRevision ensures the revision has a resolved commit SHA. If Commit is already set, it returns as-is. Otherwise it resolves the branch HEAD or tag SHA using the provided git client.
Types ¶
type GitClient ¶
type GitClient interface {
CheckAccess(ctx context.Context, repoURL string) (bool, error)
GetTagSHA(ctx context.Context, repoURL, tag string) (string, error)
CheckTagExists(ctx context.Context, repoURL, tag string) (bool, error)
GetBranchHeadSHA(ctx context.Context, repoURL, branch string) (*RepoResult, error)
GetDefaultBranch(ctx context.Context, repoURL string) (string, error)
FetchFile(ctx context.Context, repoURL, ref, filePath string) ([]byte, error)
}
func NewGitClientForRepo ¶
func NewGitClientForRepo(repoURL string, creds GitCredentials) (GitClient, error)
NewGitClientForRepo returns a GitClient backed by the GitHub REST API for github.com repos, or the generic go-git client for all other hosts.
type GitCredentials ¶
GitCredentials holds optional git authentication material. A zero value selects anonymous access.