Documentation
¶
Index ¶
- Variables
- type GitClient
- func (r *GitClient) CheckOut(branch string, localDir string) error
- func (r *GitClient) CloneMirror() error
- func (r *GitClient) CloneRepo() error
- func (r *GitClient) Diff(head string, sha string) (changes []string, err error)
- func (r *GitClient) GetLocalRepoDir() string
- func (r *GitClient) RemoveMirror() error
- func (r *GitClient) RemoveRepo() error
- type Interface
- type OwnersFile
- type Repository
- func (o *Repository) Clear() error
- func (o *Repository) GetAllApprovers(path string) map[string]string
- func (o *Repository) GetAllReviewers(path string) map[string]string
- func (o *Repository) GetApproversFilePath(path string) string
- func (o *Repository) GetClosestApprovers(path string) map[string]string
- func (o *Repository) GetClosestReviewers(path string) map[string]string
- func (o *Repository) GetReviewersFilePath(path string) string
- func (o *Repository) Init() error
- func (o *Repository) LoadOwners(branch string) error
Constants ¶
This section is empty.
Variables ¶
var (
// GithubBaseURL
GithubBaseURL = "https://github.com/"
)
var (
// OwnersFileName
OwnersFileName = "OWNERS"
)
Functions ¶
This section is empty.
Types ¶
type GitClient ¶
type GitClient struct {
// local mirror dir
LocalMirrorDir string
// local repository dir
LocalRepoDir string
// github base url
BaseURL string
// repository org and name
Repo string
}
GitClient define
func NewGitClient ¶
NewGitClient returns a git client. e.g. repo=test/hello
func (*GitClient) CheckOut ¶
CheckOut runs the command: git checkout
func (*GitClient) CloneMirror ¶
CloneMirror clones a mirror into local tmp folder
func (*GitClient) CloneRepo ¶
CloneRepo clones a repository into local tmp folder
func (*GitClient) Diff ¶
Diff runs the command: git diff
func (*GitClient) RemoveMirror ¶
RemoveMirror removes tmp local mirror dir
type Interface ¶
type Interface interface {
// Init repository
Init() error
// Clear repository
Clear() error
// LoadOwners loads an owners list
LoadOwners(branch string) error
// GetApproversFilePath returns the OWNERS file path that contains approvers
GetApproversFilePath(path string) string
// GetReviewersFilePath returns the OWNERS file path that contains reviewers
GetReviewersFilePath(path string) string
// GetClosestApprovers returns a set of users who are the closest approvers
GetClosestApprovers(path string) map[string]string
// GetClosestReviewers returns a set of users who are the closest reviewers
GetClosestReviewers(path string) map[string]string
// GetAllApprovers returns all the approvers including parent owners file
GetAllApprovers(path string) map[string]string
// GetAllReviewers returns all the reviewers including parent owners file
GetAllReviewers(path string) map[string]string
}
Interface defines for Owners
type OwnersFile ¶
type OwnersFile struct {
Approvers []string `yaml:"approvers,omitempty"`
Reviewers []string `yaml:"reviewers,omitempty"`
}
OwnersFile defines the content format of owners file
type Repository ¶
type Repository struct {
GithubClient *github.Client
GitClient *GitClient
Org string
Repo string
Sha string
RepoDir string
Approvers map[string]map[string]string
Reviewers map[string]map[string]string
}
Repository cache
func NewRepository ¶
func NewRepository(client *github.Client, repository string) (*Repository, error)
NewRepository returns an repository instance
func (*Repository) GetAllApprovers ¶
func (o *Repository) GetAllApprovers(path string) map[string]string
GetAllApprovers returns all the approvers including parent owners file
func (*Repository) GetAllReviewers ¶
func (o *Repository) GetAllReviewers(path string) map[string]string
GetAllReviewers returns all the reviewers including parent owners file
func (*Repository) GetApproversFilePath ¶
func (o *Repository) GetApproversFilePath(path string) string
GetApproversFilePath returns the OWNERS file path that contains approvers
func (*Repository) GetClosestApprovers ¶
func (o *Repository) GetClosestApprovers(path string) map[string]string
GetClosestApprovers returns a set of users who are the closest approvers
func (*Repository) GetClosestReviewers ¶
func (o *Repository) GetClosestReviewers(path string) map[string]string
GetClosestReviewers returns a set of users who are the closest reviewers
func (*Repository) GetReviewersFilePath ¶
func (o *Repository) GetReviewersFilePath(path string) string
GetReviewersFilePath returns the OWNERS file path that contains reviewers
func (*Repository) LoadOwners ¶
func (o *Repository) LoadOwners(branch string) error
LoadOwners loads an owners list
Source Files
¶
- gitclient.go
- repository.go