operator

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ROLE_PMC         = "pmc"
	ROLE_MAMINTAINER = "maintainer"
	ROLE_LEADER      = "leader"
	ROLE_COLEADER    = "co-leader"
	ROLE_COMMITTER   = "committer"
	ROLE_REVIEWER    = "reviewer"
)
View Source
const (
	LABEL_REQUIRE_LGT = "require-LGT"
)

Variables

Functions

func LabelsToStrArr

func LabelsToStrArr(labels []*github.Label) []string

Types

type AutoMergeAllowName

type AutoMergeAllowName struct {
	ID        int       `gorm:"id"`
	Owner     string    `gorm:"owner"`
	Repo      string    `gorm:"repo"`
	Username  string    `gorm:"username"`
	CreatedAt time.Time `gorm:"created_at"`
}

AutoMergeAllowName define allow name for auto merge

type CompanyEmployees

type CompanyEmployees struct {
	GithubID string `gorm:"column:github_id"`
	GMail    string `gorm:"column:gmail"`
}

type LgtmRecord

type LgtmRecord struct {
	Owner      string `gorm:"column:owner"`
	Repo       string `gorm:"column:repo"`
	PullNumber int    `gorm:"column:pull_number"`
	Github     string `gorm:"column:github"`
	Score      int    `gorm:"column:score"`
}

type Operator

type Operator struct {
	Config *config.Config
	DB     *db.DB
	Github *github.Client
	Slack  slack.Bot
	Member *member.Member
}

Operator contains pkg instances

func InitOperator

func InitOperator(cfg *config.Config) *Operator

InitOperator create context from config

func (*Operator) AddAllowList

func (o *Operator) AddAllowList(owner, repo, username string) error

func (*Operator) CommentOnGithub

func (o *Operator) CommentOnGithub(owner string, repo string, number int, commentBody string) error

CreateComment creates a new comment on the specified issue. number: issue or pull request's ID

func (*Operator) GetAllowList

func (o *Operator) GetAllowList(owner, repo string) ([]string, error)

func (*Operator) GetGmailByGithubID

func (o *Operator) GetGmailByGithubID(githubID string) (string, error)

func (*Operator) GetLGTMNumForPR

func (o *Operator) GetLGTMNumForPR(owner, repo string, pullNumber int) (num int, err error)

func (*Operator) GetLGTMReviewers

func (o *Operator) GetLGTMReviewers(owner, repo string, pullNumber int) (reviewers []string, err error)

func (*Operator) GetNumberOFLGTMByLable

func (o *Operator) GetNumberOFLGTMByLable(repo string, labels []*github.Label) int

func (*Operator) GetRolesInSigByGithubID

func (o *Operator) GetRolesInSigByGithubID(githubID string) (members []*SigMember, err error)

func (*Operator) HasPermissionToPRWithLables

func (o *Operator) HasPermissionToPRWithLables(owner, repo string, labels []*github.Label, githubID string, roles []string) error

func (*Operator) IsAllowed

func (o *Operator) IsAllowed(owner, repo string, usernames ...string) bool

func (*Operator) IsInCompany

func (o *Operator) IsInCompany(githubID string) (bool, error)

func (*Operator) ListLabelsOnGithub

func (o *Operator) ListLabelsOnGithub(owner, repo string) ([]*github.Label, error)

func (*Operator) ListSIGByLabel

func (o *Operator) ListSIGByLabel(repo string, labels []*github.Label) (sigs []*Sig, err error)

func (*Operator) RemoveAllowList

func (o *Operator) RemoveAllowList(username string) error

type Sig

type Sig struct {
	SigName    string `gorm:"sig_name"`
	SigID      int    `gorm:"sig_id"`
	Repo       string `gorm:"repo"`
	Label      string `gorm:"label"`
	ProjectURL string `gorm:"project_url"`
	SigUrl     string `gorm:"sig_url"`
	Channel    string `gorm:"channel"`
	Lgtm       int    `gorm:"column:lgtm"`
}

type SigMember

type SigMember struct {
	Sig        string `gorm:"sig"`
	GithubName string `gorm:"github"`
	Level      string `gorm:"level"`
	SigID      int    `gorm:"sig_id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL