handlers package - 6github.com/huawei-cloudnative/ci-bot/handlers - Go Packages
Documentation ¶ Index ¶ Variables func AddFlags(fs *pflag.FlagSet, s *WebHookServer) func Run(s *WebHookServer) type Config type GithubIssue type GithubPR type Server func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) type WebHookServer func NewWebHookServer() *WebHookServer Constants ¶ This section is empty. Variables ¶ View Source var ( // label LabelReg = regexp . MustCompile ("^/[Ll][Aa][Bb][Ee][Ll]") LabelCancelReg = regexp .
MustCompile ("^/[Rr][Ee][Mm][Oo][Vv][Ee]-[Ll][Aa][Bb][Ee][Ll]") // test OkToTestReg = regexp . MustCompile ("^/[Oo][Kk]-[Tt][Oo]-[Tt][Ee][Ss][Tt]") RetestReg = regexp . MustCompile ("^/[Rr][Ee][Tt][Ee][Ss][Tt]") TestReg = regexp . MustCompile ("^/[Tt][Ee][Ss][Tt]") // review and approve LgtmReg = regexp . MustCompile ("^/[Ll][Gg][Tt][Mm]") LgtmCancelReg = regexp . MustCompile ("^/[Ll][Gg][Tt][Mm] [Cc][Aa][Nn][Cc][Ee][Ll]") ApproveReg = regexp .
MustCompile ("^/[Aa][Pp][Pp][Rr][Oo][Vv][Ee]") ApproveCancelReg = regexp . MustCompile ("^/[Aa][Pp][Pp][Rr][Oo][Vv][Ee] [Cc][Aa][Nn][Cc][Ee][Ll]") //assign/unassign AssignOrUnassing = regexp . MustCompile ("(?mi)^/(un)?assign(( @?[-\\w]+?)*)\\s*$") ) View Source var ClientRepo * github . Client Github client View Source var IsIssueCommentHandling = false Syncronization Flag for IssueComment and PR event Handling A Comment in PR section will lead Github to throw 2 webhook events which are 1.The Webhook event name is "issue_comment" 2.The Webhook event name is "pull_request" sequentially. let the handling only be with issue_comment event not pull_request event Functions ¶ func AddFlags ¶ func AddFlags(fs * pflag .
FlagSet , s * WebHookServer ) function to add flags func Run ¶ func Run(s * WebHookServer ) function to run Types ¶ type Config ¶ type Config struct { Repo string `json:"repo"` GitHubToken string `json:"git_hub_token"` WebhookSecret string `json:"webhook_secret"` TravisCIToken string `json:"travis_ci_token"` TravisRepoName string `json:"travis_ci_repoaccount"` } config structure type GithubIssue ¶ type GithubIssue github .
Issue type GithubPR ¶ type GithubPR github . PullRequestEvent type Server ¶ type Server struct { Config Config GithubClient * github . Client Repository repository . Interface Context context . Context } Server implements http.Handler. It validates incoming GitHub webhooks and then dispatches them to the handlers accordingly. func (*Server) ServeHTTP ¶ func (s * Server ) ServeHTTP(w http . ResponseWriter , r * http .
Request ) ServeHTTP validates an incoming webhook and invoke its handler. type WebHookServer ¶ type WebHookServer struct { Address string Port int64 ConfigFile string } webhook server func NewWebHookServer ¶ func NewWebHookServer() * WebHookServer webhook handler Source Files ¶ issue.go pullrequest.go server.go util.go Directories ¶ Path Synopsis approve assign label lgtm repository retest types util Click to show internal directories.
Click to hide internal directories. go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic. Learn more.