Documentation
¶
Overview ¶
Package github lists and clones repositories from a GitHub org via the GitHub API and the git CLI.
Index ¶
Constants ¶
const ( StatusCloned = "cloned" StatusSkipped = "skipped" StatusFailed = "failed" )
Clone result statuses, the allowed values of CloneResult.Status.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CloneResult ¶
type CloneResult struct {
Repo RemoteRepo `json:"repo"`
Path string `json:"path"`
Status string `json:"status"`
Reason string `json:"reason,omitempty"`
Error string `json:"error,omitempty"`
}
CloneResult is the outcome of cloning one remote repository.
func CloneOrg ¶
func CloneOrg(ctx context.Context, org, root, match string, includeArchived bool, concurrency int) ([]CloneResult, error)
CloneOrg lists an org's repos and clones them into root.
func CloneRepos ¶
func CloneRepos(ctx context.Context, repos []RemoteRepo, root string, concurrency int) []CloneResult
CloneRepos clones each repo into root concurrently, returning results in order.
type RemoteRepo ¶
type RemoteRepo struct {
Name string `json:"name"`
SSHURL string `json:"ssh_url"`
CloneURL string `json:"clone_url"`
Archived bool `json:"archived"`
}
RemoteRepo is a repository discovered on the remote (e.g. a GitHub org).
func ListOrgRepos ¶
func ListOrgRepos(ctx context.Context, org, match string, includeArchived bool) ([]RemoteRepo, error)
ListOrgRepos lists an org's repositories, optionally filtered by the match regexp and excluding archived repos.
type RepoStatus ¶ added in v0.2.0
type RepoStatus struct {
OpenPRs int `json:"open_prs"`
PRs []PR `json:"prs"` // a capped sample, for the detail view
CIState string `json:"ci_state"` // "passing" | "failing" | "pending" | "" (none/unknown)
Err error `json:"-"`
}
RepoStatus is a repo's GitHub state: its open pull requests and the latest CI conclusion on the default branch.
func RepoStatusFor ¶ added in v0.2.0
func RepoStatusFor(ctx context.Context, owner, repo, ref string) RepoStatus
RepoStatusFor fetches open PRs and the CI status of ref (the default branch) for owner/repo. GitHub-only; needs a token (GITHUB_TOKEN or gh auth token).