Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeOwners(content string) []string
- func GetChangeLabels(confDelLabels []string, prLabels []gitee.Label) (delLabels, updateLabels []string)
- func GetEmails(ak string) ([]gitee.Email, error)
- func GetLabelsMap(comment string) map[string]string
- func GetListOfAddLabels(mapOfAddLabels map[string]string, listofRepoLabels []gitee.Label, ...) []string
- func GetListOfRemoveLabels(mapOfRemoveLabels map[string]string, listofItemLabels []gitee.Label) []string
- func GetToken(code string) (*oauth2.Token, error)
- func GetUser(ak string) (gitee.User, error)
- func IsBranchFrozen(branch string, community string) (owner []string, isFrozen bool)
- func ParseDiffInfoAndGetProjectName(diff string) (prjnames []string)
- func Setup(client, redirect, secret string) *oauth2.Config
- func UrlEncode(str string) string
- type Branch
- type CLAHandler
- func (s *CLAHandler) HandleClaCheck(w http.ResponseWriter, r *http.Request, code string)
- func (s *CLAHandler) HandleRequest(w http.ResponseWriter, request CLARequest, accesskey string)
- func (s *CLAHandler) HandleResult(w http.ResponseWriter, r CLAResult)
- func (s *CLAHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type CLARequest
- type CLAResult
- type Community
- type FrozenBranchYaml
- type FrozenHandler
- type FrozenYaml
- type InitHandler
- type OwnerHandler
- type OwnersFile
- type Projects
- type RepoHandler
- type Repos
- type Repository
- type Server
- func (s *Server) AddApprove(event *gitee.NoteEvent) error
- func (s *Server) AddLabel(event *gitee.NoteEvent) error
- func (s *Server) AddLabelInIssue(event *gitee.NoteEvent) error
- func (s *Server) AddLabelInPulRequest(event *gitee.NoteEvent) error
- func (s *Server) AddLgtm(event *gitee.NoteEvent) error
- func (s *Server) AddSpecifyLabelsInPulRequest(event *gitee.NoteEvent, newLabels []string, createNew bool) error
- func (s *Server) Assign(event *gitee.NoteEvent) error
- func (s *Server) CheckCLAByNoteEvent(event *gitee.NoteEvent) error
- func (s *Server) CheckCLAByPullRequestEvent(event *gitee.PullRequestEvent) error
- func (s *Server) CheckIsOwner(event *gitee.NoteEvent, author string) bool
- func (s *Server) CheckLgtmByPullRequestUpdate(event *gitee.PullRequestEvent) error
- func (s *Server) CheckPr(event *gitee.NoteEvent) (err error)
- func (s *Server) CheckSpecialFileHasModified(event *gitee.PullRequestEvent, specialfile string) (diff string)
- func (s *Server) CheckWetherNewItemInObsProjects(event *gitee.PullRequestEvent, prjname string, branch string, repo string, ...) (exist bool)
- func (s *Server) Close(event *gitee.NoteEvent) error
- func (s *Server) FillServicePathAndContentWithProjectName(prjname string) (_servicepath string, _service string)
- func (s *Server) GetOwners(event *gitee.NoteEvent) []string
- func (s *Server) HandleIssueEvent(event *gitee.IssueEvent)
- func (s *Server) HandleNoteEvent(event *gitee.NoteEvent)
- func (s *Server) HandlePullRequestEvent(actionDesc string, event *gitee.PullRequestEvent)
- func (s *Server) HandlePushEvent(event *gitee.PushEvent)
- func (s *Server) HandleWatchProjectFiles(event *gitee.PushEvent)
- func (s *Server) HandleWatchSigFiles(event *gitee.PushEvent)
- func (s *Server) MergePullRequest(event *gitee.NoteEvent) error
- func (s *Server) NewFileWithPathAndContentInPullRequest(event *gitee.PullRequestEvent, path string, content string, branch string, ...)
- func (s *Server) ReOpen(event *gitee.NoteEvent) error
- func (s *Server) RemoveApprove(event *gitee.NoteEvent) error
- func (s *Server) RemoveAssigneesInPullRequest(event *gitee.NoteEvent) error
- func (s *Server) RemoveLabel(event *gitee.NoteEvent) error
- func (s *Server) RemoveLabelInIssue(event *gitee.NoteEvent) error
- func (s *Server) RemoveLabelInPullRequest(event *gitee.NoteEvent) error
- func (s *Server) RemoveLgtm(event *gitee.NoteEvent) error
- func (s *Server) RemoveSpecifyLabelsInPulRequest(event *gitee.NoteEvent, mapOfRemoveLabels map[string]string) error
- func (s *Server) RemoveTestersInPullRequest(event *gitee.NoteEvent) error
- func (s *Server) SendNote4AutomaticNewFile(event *gitee.PullRequestEvent)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) UnAssign(event *gitee.NoteEvent) error
- func (s *Server) UpdateLabelsBySourceBranchChange(delLabels, updateLabels []string, event *gitee.PullRequestEvent) error
- func (s *Server) ValidateCommits(event *gitee.PullRequestEvent) error
- type Sig
- type SigHandler
- type SigsYaml
- type Webhook
Constants ¶
const ( ErrorCode_OK = iota ErrorCode_ServerHandleError ErrorCode_EmailError ErrorCode_TelephoneError ErrorCode_EmailNotTheSameError )
const ( PrivilegeManager = "manager" PrivilegeDeveloper = "developer" PrivilegeViewer = "viewer" PrivilegeReporter = "reporter" PermissionAdmin = "admin" PermissionPush = "push" PermissionPull = "pull" BranchProtected = "protected" BranchNormal = "normal" // not supported yet BranchReadonly = "readonly" )
const ( RemoveKind = "/remove-kind" AddClaYes = "/%s-cla yes" AddClaNo = "/%s-cla no" RemoveClaYes = "/remove-%s-cla yes" RemoveClaNo = "/remove-%s-cla no" LabelNameLgtm = "lgtm" LabelLgtmWithCommenter = "lgtm-%s" LabelNameApproved = "approved" LabelHiddenValue = "<input type=hidden value=%s />" DisplayCommittors = `If you have any questions, please contact the SIG: [%s](%s), and any of the maintainers: ` SigPath = `https://gitee.com/openeuler/community/tree/master/sig/%s` AutoAddPrjMsg = `` /* 269-byte string literal not displayed */ )
const COOKIE_KEY string = "cla-info"
Variables ¶
var ( // RegAddLabel RegAddLabel = regexp.MustCompile(`(?mi)^/(kind|priority|sig)\s*(.*)$`) // RegRemoveLabel RegRemoveLabel = regexp.MustCompile(`(?mi)^/remove-(kind|priority|sig)\s*(.*)$`) // RegCheckCLA RegCheckCLA = regexp.MustCompile(`(?mi)^/check-cla\s*$`) // RegAddLgtm RegAddLgtm = regexp.MustCompile(`(?mi)^/lgtm\s*$`) // RegRemoveLgtm RegRemoveLgtm = regexp.MustCompile(`(?mi)^/lgtm cancel\s*$`) // RegAddApprove RegAddApprove = regexp.MustCompile(`(?mi)^/approve\s*$`) // RegRemoveApprove RegRemoveApprove = regexp.MustCompile(`(?mi)^/approve cancel\s*$`) // RegClose RegClose = regexp.MustCompile(`(?mi)^/close\s*$`) // RegReOpen RegReOpen = regexp.MustCompile(`(?mi)^/reopen\s*$`) // RegBotAddLgtm RegBotAddLgtm = regexp.MustCompile(fmt.Sprintf(LabelHiddenValue, "(.*)")) // RegAssign RegAssign = regexp.MustCompile(`(?mi)^/assign(( @?[-\w]+?)*)\s*$`) // RegUnAssign RegUnAssign = regexp.MustCompile(`(?mi)^/unassign(( @?[-\w]+?)*)\s*$`) // RegCheckPr RegCheckPr = regexp.MustCompile(`(?mi)^/check-pr\s*$`) )
var (
DefaultOwnerFileName = "OWNERS"
)
var Endpoint = oauth2.Endpoint{
AuthURL: "https://gitee.com/oauth/authorize",
TokenURL: "https://gitee.com/oauth/token",
}
Functions ¶
func DecodeOwners ¶
func GetChangeLabels ¶
func GetChangeLabels(confDelLabels []string, prLabels []gitee.Label) (delLabels, updateLabels []string)
GetChangeLabels return the exact list of delete and update labels
func GetLabelsMap ¶
GetLabelsMap for add or remove labels
func GetListOfAddLabels ¶
func GetListOfAddLabels(mapOfAddLabels map[string]string, listofRepoLabels []gitee.Label, listofItemLabels []gitee.Label) []string
GetListOfAddLabels return the exact list of add labels
func GetListOfRemoveLabels ¶
func GetListOfRemoveLabels(mapOfRemoveLabels map[string]string, listofItemLabels []gitee.Label) []string
GetListOfRemoveLabels return the exact list of remove labels
func IsBranchFrozen ¶
IsBranchFrozen Check if the branch is frozen
func ParseDiffInfoAndGetProjectName ¶
parse diff info
Types ¶
type CLAHandler ¶
func (*CLAHandler) HandleClaCheck ¶
func (s *CLAHandler) HandleClaCheck(w http.ResponseWriter, r *http.Request, code string)
func (*CLAHandler) HandleRequest ¶
func (s *CLAHandler) HandleRequest(w http.ResponseWriter, request CLARequest, accesskey string)
HandleRequest handles the cla request
func (*CLAHandler) HandleResult ¶
func (s *CLAHandler) HandleResult(w http.ResponseWriter, r CLAResult)
HandleResult output result to client
func (*CLAHandler) ServeHTTP ¶
func (s *CLAHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP validates an incoming cla request.
type CLARequest ¶
type CLARequest struct { Type int `json:"type,omitempty"` Name *string `json:"name,omitempty"` Title *string `json:"title,omitempty"` Corporation *string `json:"corporation,omitempty"` Address *string `json:"address,omitempty"` Date *string `json:"date,omitempty"` Email *string `json:"email,omitempty"` Telephone *string `json:"telephone,omitempty"` Fax *string `json:"fax,omitempty"` }
type FrozenBranchYaml ¶
type FrozenBranchYaml struct { Branch string `yaml:"branch"` Frozen bool `yaml:"frozen"` Owner []string `yaml:"owner"` Communtiy []string `yaml:"community"` }
FrozenBranchYaml Branch freeze configuration
type FrozenHandler ¶
type FrozenHandler struct { Config config.Config Context context.Context GiteeClient *gitee.APIClient }
FrozenHandler Handling frozen branches
func (*FrozenHandler) Server ¶
func (fh *FrozenHandler) Server()
type FrozenYaml ¶
type FrozenYaml struct {
Release []FrozenBranchYaml `yaml:"release"`
}
FrozenYaml freeze configuration
type InitHandler ¶
type OwnerHandler ¶
type OwnersFile ¶
type OwnersFile struct {
Maintainers []string `yaml:"maintainers"`
}
type Projects ¶
type Projects struct { Community Community `yaml:"community"` Repositories []Repository `yaml:"repositories"` }
type RepoHandler ¶
type Repos ¶
type Repos struct { Version string `yaml:"version"` Community string `yaml:"community"` Repositories []Repository `yaml:"repositories"` }
type Repository ¶
type Repository struct { Name *string `yaml:"name"` Description *string `yaml:"description"` ProtectedBranches []string `yaml:"protected_branches"` Commentable *bool `yaml:"commentable"` Type *string `yaml:"type"` RenameFrom *string `yaml:"rename_from"` Managers []string `yaml:"managers"` Developers []string `yaml:"developers"` Viewers []string `yaml:"viewers"` Reporters []string `yaml:"reporters"` Branches []Branch `yaml:"branches"` }
func (Repository) IsCommentable ¶
func (r Repository) IsCommentable() bool
IsCommentable returns if contributors are able to comment to the repository. It will be true only if Commentable is explicitly sepecified as true
type Server ¶
func (*Server) AddApprove ¶
AddApprove adds approved label
func (*Server) AddLabelInIssue ¶
AddLabelInIssue adds label in issue
func (*Server) AddLabelInPulRequest ¶
AddLabelInPulRequest adds label in pull request
func (*Server) AddSpecifyLabelsInPulRequest ¶
func (s *Server) AddSpecifyLabelsInPulRequest(event *gitee.NoteEvent, newLabels []string, createNew bool) error
AddSpecifyLabelInPulRequest adds specify labels in pull request
func (*Server) CheckCLAByNoteEvent ¶
CheckCLAByNoteEvent check cla by NoteEvent
func (*Server) CheckCLAByPullRequestEvent ¶
func (s *Server) CheckCLAByPullRequestEvent(event *gitee.PullRequestEvent) error
CheckCLAByPullRequestEvent check cla by PullRequestEvent
func (*Server) CheckIsOwner ¶
CheckIsOwner checks the author is owner in repository
func (*Server) CheckLgtmByPullRequestUpdate ¶
func (s *Server) CheckLgtmByPullRequestUpdate(event *gitee.PullRequestEvent) error
CheckLgtmByPullRequestUpdate checks lgtm when received the pull request update event
func (*Server) CheckSpecialFileHasModified ¶
func (s *Server) CheckSpecialFileHasModified(event *gitee.PullRequestEvent, specialfile string) (diff string)
Get the diff info with merge and choose projects to be added
func (*Server) CheckWetherNewItemInObsProjects ¶
func (s *Server) CheckWetherNewItemInObsProjects(event *gitee.PullRequestEvent, prjname string, branch string, repo string, owner string) (exist bool)
Check whether the new item in src-openeuler.yaml is in project
func (*Server) FillServicePathAndContentWithProjectName ¶
func (s *Server) FillServicePathAndContentWithProjectName(prjname string) (_servicepath string, _service string)
Fill file _service path and content
func (*Server) HandleIssueEvent ¶
func (s *Server) HandleIssueEvent(event *gitee.IssueEvent)
HandleIssueEvent handles issue event
func (*Server) HandleNoteEvent ¶
HandleNoteEvent handles note event
func (*Server) HandlePullRequestEvent ¶
func (s *Server) HandlePullRequestEvent(actionDesc string, event *gitee.PullRequestEvent)
HandlePullRequestEvent handles pull request event
func (*Server) HandlePushEvent ¶
HandlePushEvent handles push event
func (*Server) HandleWatchProjectFiles ¶
HandleWatchProjectFiles
func (*Server) HandleWatchSigFiles ¶
HandleWatchSigFiles
func (*Server) MergePullRequest ¶
MergePullRequest with lgtm and approved label
func (*Server) NewFileWithPathAndContentInPullRequest ¶
func (s *Server) NewFileWithPathAndContentInPullRequest(event *gitee.PullRequestEvent, path string, content string, branch string, repo string, owner string)
New project with name in pull
func (*Server) RemoveApprove ¶
RemoveApprove removes approved label
func (*Server) RemoveAssigneesInPullRequest ¶
RemoveAssigneesInPullRequest remove assignees in pull request
func (*Server) RemoveLabel ¶
RemoveLabel removes label
func (*Server) RemoveLabelInIssue ¶
RemoveLabelInIssue removes label in issue
func (*Server) RemoveLabelInPullRequest ¶
RemoveLabelInPullRequest removes label in pull request
func (*Server) RemoveLgtm ¶
RemoveLgtm removes lgtm label
func (*Server) RemoveSpecifyLabelsInPulRequest ¶
func (s *Server) RemoveSpecifyLabelsInPulRequest(event *gitee.NoteEvent, mapOfRemoveLabels map[string]string) error
RemoveSpecifyLabelsInPulRequest removes specify labels in pull request
func (*Server) RemoveTestersInPullRequest ¶
RemoveTestersInPullRequest remove testers in pull request
func (*Server) SendNote4AutomaticNewFile ¶
func (s *Server) SendNote4AutomaticNewFile(event *gitee.PullRequestEvent)
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP validates an incoming webhook and invoke its handler.
func (*Server) UpdateLabelsBySourceBranchChange ¶
func (s *Server) UpdateLabelsBySourceBranchChange(delLabels, updateLabels []string, event *gitee.PullRequestEvent) error
func (*Server) ValidateCommits ¶
func (s *Server) ValidateCommits(event *gitee.PullRequestEvent) error