{"modulePath":"github.com/sourcegraph/maintainerbot","version":"v0.0.0-20200204165715-d8ca063a7c64","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package maintainerbot\n\nPackage maintainerbot contains tools for running automated tasks on a Github repo.\n\nCall maintainerbot.New() to create a new bot, then register tasks on it with bot.RegisterTask(). Finally, bot.Run() will run the tasks in a loop, calling each Task periodically. The Task can do whatever it needs to do to update the repository as it sees fit.\n\n## Functions\n\n```go\nfunc NewGitHubClient(token string, rateLimit time.Duration) *github.Client\n```\nNewGitHubClient creates a new GitHub client for the given token. rateLimit is the duration between requests; a rate limit of 0 defaults to 5000 requests per hour.\n\n## Types\n\n```go\ntype Bot struct {\n\t// Directory for caching local data about issues and pull requests.\n\t// Defaults to $HOME/var/maintainerbot.\n\tDataDir string\n\t// Interval between queries to send to GitHub. Defaults to 720ms, which\n\t// works out to 5000 queries per hour.\n\tGitHubRateLimit time.Duration\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New(owner, repo, token string) *Bot\n```\nNew creates a new Bot.\n\n```go\nfunc (b *Bot) RegisterTask(t Task)\n```\nRegisterTask registers t with the bot. When the Bot is running, t will be called periodically with the latest repo contents.\n\n```go\nfunc (b *Bot) Run(ctx context.Context)\n```\nRun calls each registered task in turn with the updated contents of the GitHub repository, until the context is canceled. If a task returns a non-zero error, it is logged to the console.\n\n```go\ntype Task interface {\n\tDo(ctx context.Context, repo *maintner.GitHubRepo) error\n}\n```\nTask is any periodic task that you would like to run on the repository.\n\n","path":"github.com/sourcegraph/maintainerbot","name":"maintainerbot","synopsis":"Package maintainerbot contains tools for running automated tasks on a Github repo.","isRedistributable":true}
