{"modulePath":"github.com/dalanlan/contrib","version":"v0.0.0-20151013003358-a13469294143","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\n## Functions\n\n```go\nfunc GetLabelsWithPrefix(labels []github.Label, prefix string) []string\n```\nGetLabelsWithPrefix will return a slice of all label names in \\`labels\\` which start with given prefix.\n\n```go\nfunc HasLabel(labels []github.Label, name string) bool\n```\nHasLabel returns if the label \\`name\\` is in the array of \\`labels\\`\n\n```go\nfunc HasLabels(labels []github.Label, names []string) bool\n```\nHasLabels returns if all of the label \\`names\\` are in the array of \\`labels\\`\n\n```go\nfunc LabelTime(label string, events []github.IssueEvent) *time.Time\n```\nLabelTime returns the last time the request label was added to an issue. If the label was never added you will get the 0 time.\n\n```go\nfunc LastModifiedTime(commits []github.RepositoryCommit) *time.Time\n```\nLastModifiedTime returns the date of the latest commit\n\n## Types\n\n```go\ntype Config struct {\n\tOrg     string\n\tProject string\n\n\tRateLimit      float32\n\tRateLimitBurst int\n\n\tToken     string\n\tTokenFile string\n\n\tMinPRNumber int\n\tMaxPRNumber int\n\n\t// If true, don't make any mutating API calls\n\tDryRun bool\n\n\t// Defaults to 30 seconds.\n\tPendingWaitTime *time.Duration\n\t// contains filtered or unexported fields\n}\n```\nConfig is how we are configured to talk to github and provides access methods for doing so.\n\n```go\nfunc (config *Config) AddLabels(prNum int, labels []string) error\n```\nAddLabels will add all of the named \\`labels\\` to the PR\n\n```go\nfunc (config *Config) AddRootFlags(cmd *cobra.Command)\n```\nAddRootFlags will add all of the flags needed for the github config to the cobra command\n\n```go\nfunc (config *Config) AssignPR(prNum int, owner string) error\n```\nAssignPR will assign \\`prNum\\` to the \\`owner\\` where the \\`owner\\` is asignee's github login\n\n```go\nfunc (config *Config) ClosePR(pr *github.PullRequest) error\n```\nClosePR will close the Given PR\n\n```go\nfunc (config *Config) ForEachIssueDo(labels []string, fn IssueFunction) error\n```\nForEachIssueDo will call the provided IssueFunction once for each issue which has the labels provided in \\`labels\\`\n\n```go\nfunc (config *Config) ForEachPRDo(labels []string, fn PRFunction) error\n```\nForEachPRDo will call the provided PRFunction once for each issue which has the labels provided in \\`labels\\`\n\n```go\nfunc (config *Config) GetAllEventsForPR(prNum int) ([]github.IssueEvent, error)\n```\nGetAllEventsForPR returns a list of all events for a given pr.\n\n```go\nfunc (config *Config) GetFileContents(file, sha string) (string, error)\n```\nGetFileContents will return the contents of the \\`file\\` in the repo at \\`sha\\` as a string\n\n```go\nfunc (config *Config) GetFilledCommits(prNum int) ([]github.RepositoryCommit, error)\n```\nGetFilledCommits returns all of the commits for a given PR\n\n```go\nfunc (config *Config) GetPR(prNum int) (*github.PullRequest, error)\n```\nGetPR will return a pull request based on the provided number. This may be useful if some of the information in the provided PR was not filled out when it was retrieved.\n\n```go\nfunc (config *Config) GetStatus(pr *github.PullRequest, requiredContexts []string) (string, error)\n```\nGetStatus gets the current status of a PR.\n\n  - If any member of the 'requiredContexts' list is missing, it is 'incomplete'\n  - If any is 'pending', the PR is 'pending'\n  - If any is 'error', the PR is in 'error'\n  - If any is 'failure', the PR is 'failure'\n  - Otherwise the PR is 'success'\n\n```go\nfunc (config *Config) GetUser(login string) (*github.User, error)\n```\nGetUser will return information about the github user with the given login name\n\n```go\nfunc (config *Config) IsPRMergeable(pr *github.PullRequest) (bool, error)\n```\nIsPRMergeable will return if the PR is mergeable. It will pause and get the PR again if github did not respond the first time. So the hopefully github will have a response the second time. If we have no answer twice, we return false\n\n```go\nfunc (config *Config) IsStatusSuccess(pr *github.PullRequest, requiredContexts []string) bool\n```\nIsStatusSuccess makes sure that the combined status for all commits in a PR is 'success'\n\n```go\nfunc (config *Config) LastModifiedTime(prNum int) (*time.Time, error)\n```\nLastModifiedTime returns the time the last commit was made BUG: this should probably return the last time a git push happened or something like that.\n\n```go\nfunc (config *Config) MergePR(pr *github.PullRequest, who string) error\n```\nMergePR will merge the given PR, duh \"who\" is who is doing the merging, like \"submit-queue\"\n\n```go\nfunc (config *Config) OpenPR(pr *github.PullRequest, numTries int) error\n```\nOpenPR will attempt to open the given PR. It will attempt to reopen the pr \\`numTries\\` before returning an error and giving up.\n\n```go\nfunc (config *Config) PreExecute() error\n```\nPreExecute will initialize the Config. It MUST be run before the config may be used to get information from Github\n\n```go\nfunc (config *Config) RemoveLabel(prNum int, label string) error\n```\nRemoveLabel will remove the \\`label\\` from the PR\n\n```go\nfunc (config *Config) ResetAPICount()\n```\nResetAPICount will both reset the counters of how many api calls have been made but will also print the information from the last run.\n\n```go\nfunc (config *Config) SetClient(client *github.Client)\n```\nSetClient should ONLY be used by testing. Normal commands should use PreExecute()\n\n```go\nfunc (config *Config) UsersWithAccess() ([]github.User, []github.User, error)\n```\nUsersWithAccess returns two sets of users. The first set are users with push access. The second set is the specific set of user with pull access. If the repo is public all users will have pull access, but some with have it explicitly\n\n```go\nfunc (config *Config) WaitForNotPending(pr *github.PullRequest) error\n```\nWaitForNotPending will check if the github status is \"pending\" (CI still running) if so it will sleep and try again until all status hooks have complete\n\n```go\nfunc (config *Config) WaitForPending(pr *github.PullRequest) error\n```\nWaitForPending will wait for a PR to move into Pending.  This is useful because the request to test a PR again is asynchronous with the PR actually moving into a pending state TODO: add a timeout\n\n```go\nfunc (config *Config) WriteComment(prNum int, msg string) error\n```\nWriteComment will send the \\`msg\\` as a comment to the specified PR\n\n```go\ntype IssueFunction func(*github.Issue) error\n```\nIssueFunction is the type that must be implemented and passed to ForEachIssueDo\n\n```go\ntype PRFunction func(*github.PullRequest, *github.Issue) error\n```\nPRFunction is the type that must be implemented and passed to ForEachPRDo\n\n","path":"github.com/dalanlan/contrib/mungegithub/github","name":"github","synopsis":"","isRedistributable":true}
