Documentation
¶
Overview ¶
Setup GitHub client
pull request interactions - open/close/nag code reviewers for approval
Getting repos to perform the code changes in - probably choose between a GitHub search and graphql (?)
Getting repos to perform the code changes in - probably choose between a GitHub search and graphql (?)
Index ¶
- type GithubClient
- func (gc *GithubClient) AssignDefaultReviewer(pr *github.PullRequest) error
- func (gc *GithubClient) CreatePullRequest(org, repo, title, body, base_branch, merge_branch string, asDraft bool) (string, error)
- func (gc *GithubClient) FindPullRequest(org, repo, baseBranch, headBranch string) (*github.PullRequest, error)
- func (gc *GithubClient) GetAllRepos(owner string) ([]string, error)
- func (gc *GithubClient) GetDefaultBranch(owner, repo string) (string, error)
- func (gc *GithubClient) GetMatchingPRs(query string) ([]*github.PullRequest, error)
- func (gc *GithubClient) GetMatchingRepos(query string) ([]string, error)
- func (gc *GithubClient) GetPR(owner, repo string, number int) (*github.PullRequest, error)
- func (gc *GithubClient) GitAddAll(dir string) error
- func (gc *GithubClient) GitCommit(dir, message, name, email string) error
- func (gc *GithubClient) GitIsClean(dir string) (bool, error)
- func (gc *GithubClient) GitResetToRef(dir, ref string) error
- func (gc *GithubClient) GitWorktreePrune(repoDir string) error
- func (gc *GithubClient) GitWorktreeRemove(repoDir, worktreeDir string) error
- func (gc *GithubClient) MergePullRequest(pr *github.PullRequest) error
- func (gc *GithubClient) Push(branch, dir, org, repoName string) error
- func (gc *GithubClient) ShallowClone(org, repoName, dir, migrationBranchName string) (string, error)
- func (gc *GithubClient) ShallowCloneWorktree(org, repoName, cacheDir, worktreeDir, migrationBranchName string) (string, error)
- func (gc *GithubClient) UpdatePullRequest(pr *github.PullRequest, body string) error
- type PRDataWorker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GithubClient ¶
type GithubClient struct {
Client *github.Client
GlobalConfig *configs.GlobalConfig
// contains filtered or unexported fields
}
func NewGithubClient ¶
func NewGithubClient(globalConf configs.GlobalConfig, ctx context.Context, log *logrus.Entry) (*GithubClient, error)
Build a new GitHub client using the global config
func (*GithubClient) AssignDefaultReviewer ¶
func (gc *GithubClient) AssignDefaultReviewer(pr *github.PullRequest) error
func (*GithubClient) CreatePullRequest ¶
func (gc *GithubClient) CreatePullRequest(org, repo, title, body, base_branch, merge_branch string, asDraft bool) (string, error)
func (*GithubClient) FindPullRequest ¶
func (gc *GithubClient) FindPullRequest(org, repo, baseBranch, headBranch string) (*github.PullRequest, error)
func (*GithubClient) GetAllRepos ¶
func (gc *GithubClient) GetAllRepos(owner string) ([]string, error)
func (*GithubClient) GetDefaultBranch ¶
func (gc *GithubClient) GetDefaultBranch(owner, repo string) (string, error)
Get the default branch set for the repo on GitHub
func (*GithubClient) GetMatchingPRs ¶
func (gc *GithubClient) GetMatchingPRs(query string) ([]*github.PullRequest, error)
func (*GithubClient) GetMatchingRepos ¶
func (gc *GithubClient) GetMatchingRepos(query string) ([]string, error)
Get all repos returned by a code search query
func (*GithubClient) GetPR ¶
func (gc *GithubClient) GetPR(owner, repo string, number int) (*github.PullRequest, error)
func (*GithubClient) GitAddAll ¶
func (gc *GithubClient) GitAddAll(dir string) error
GitAddAll stages all changes in dir.
func (*GithubClient) GitCommit ¶
func (gc *GithubClient) GitCommit(dir, message, name, email string) error
GitCommit creates a commit with the given message and author identity.
func (*GithubClient) GitIsClean ¶
func (gc *GithubClient) GitIsClean(dir string) (bool, error)
GitIsClean reports whether the working tree has no uncommitted changes.
func (*GithubClient) GitResetToRef ¶ added in v2.3.0
func (gc *GithubClient) GitResetToRef(dir, ref string) error
GitResetToRef hard-resets the current branch to the given ref.
func (*GithubClient) GitWorktreePrune ¶ added in v2.1.0
func (gc *GithubClient) GitWorktreePrune(repoDir string) error
GitWorktreePrune removes stale worktree metadata from the repo.
func (*GithubClient) GitWorktreeRemove ¶ added in v2.1.0
func (gc *GithubClient) GitWorktreeRemove(repoDir, worktreeDir string) error
GitWorktreeRemove removes a git worktree from the given repo directory.
func (*GithubClient) MergePullRequest ¶
func (gc *GithubClient) MergePullRequest(pr *github.PullRequest) error
func (*GithubClient) Push ¶
func (gc *GithubClient) Push(branch, dir, org, repoName string) error
Push pushes the current HEAD to the remote.
func (*GithubClient) ShallowClone ¶
func (gc *GithubClient) ShallowClone(org, repoName, dir, migrationBranchName string) (string, error)
ShallowClone clones (or opens + pulls) a repo and checks out the migration branch. It returns the default branch name so callers do not need a separate GetDefaultBranch call.
func (*GithubClient) ShallowCloneWorktree ¶ added in v2.1.0
func (gc *GithubClient) ShallowCloneWorktree(org, repoName, cacheDir, worktreeDir, migrationBranchName string) (string, error)
ShallowCloneWorktree clones (or updates) the cached repo on the default branch, then creates a git worktree for the migration branch. Returns the default branch name.
func (*GithubClient) UpdatePullRequest ¶
func (gc *GithubClient) UpdatePullRequest(pr *github.PullRequest, body string) error
type PRDataWorker ¶
type PRDataWorker struct {
// contains filtered or unexported fields
}
func NewPRDataWorker ¶
func NewPRDataWorker(client *GithubClient) *PRDataWorker