Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OperateOnRepos ¶
func OperateOnRepos(config *config.GitXargsConfig) error
OperateOnRepos acts as a switch, depending upon whether the user provided an explicit list of repos to operate.
There are three ways to select repos to operate on via this tool: 1. the --repo flag, which specifies a single repo, and which can be passed multiple times, e.g., --repo gruntwork-io/fetch --repo gruntwork-io/cloud-nuke, etc. 2. the --repos flag which specifies the path to the user-defined flat file of repos in the format of 'gruntwork-io/cloud-nuke', one repo per line. 3. the --github-org flag which specifies the GitHub organization that should have all its repos fetched via API.
However, even though there are two methods for users to select repos, we still only want a single uniform interface for dealing with a repo throughout this tool, and that is the *github.Repository type provided by the go-github library. Therefore, this function serves the purpose of creating that uniform interface, by looking up flat file-provided repos via go-github, so that we're only ever dealing with pointers to github.Repositories going forward.
func ProcessRepos ¶
func ProcessRepos(gitxargsConfig *config.GitXargsConfig, repos []*github.Repository) error
We process all work that can be done up to the open pull request API call in parallel However, we then separately process all open pull request jobs, through the PRChan. We do this so that we can insert a configurable buffer of time between open pull request API calls, which must be staggered to avoid tripping the GitHub API's rate limiting mechanisms See https://github.com/gruntwork-io/git-xargs/issues/53 for more information
Types ¶
type RepoSelection ¶
type RepoSelection struct { SelectionType RepoSelectionCriteria AllowedRepos []*types.AllowedRepo GithubOrganizationName string }
RepoSelection is a struct that presents a uniform interface to present to OperateRepos that converts user-supplied repos in the format of <org-name>/<repo-name> to GitHub API response objects that we actually pass into processRepos which does the git cloning, command execution, committing and pull request opening
func (RepoSelection) GetAllowedRepos ¶
func (r RepoSelection) GetAllowedRepos() []*types.AllowedRepo
func (RepoSelection) GetCriteria ¶
func (r RepoSelection) GetCriteria() RepoSelectionCriteria
func (RepoSelection) GetGithubOrg ¶
func (r RepoSelection) GetGithubOrg() string
type RepoSelectionCriteria ¶
type RepoSelectionCriteria string
const ( ReposViaStdIn RepoSelectionCriteria = "repo-stdin" ExplicitReposOnCommandLine RepoSelectionCriteria = "repo-flag" ReposFilePath RepoSelectionCriteria = "repos-file" GithubOrganization RepoSelectionCriteria = "github-org" )