handlers

package
v0.0.0-...-0f89c28 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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