hook

package
v0.0.0-...-5b1f977 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionOpen        = "open"
	ActionOpened      = "opened"
	ActionClose       = "close"
	ActionCreate      = "create"
	ActionDelete      = "delete"
	ActionSync        = "sync"
	ActionUpdate      = "update"
	ActionSynchronize = "synchronize"
)
View Source
const (
	// EVENTS_TYPE_COMMENT 评论事件
	EVENTS_TYPE_COMMENT = "comment"
	// EVENTS_TYPE_PR pull request事件
	EVENTS_TYPE_PR = "pr"
	// EVENTS_TYPE_PUSH push事件
	EVENTS_TYPE_PUSH = "push"
	// EVENTS_TYPE_BUILD 手动运行事件
	EVENTS_TYPE_BUILD = "build"
	// EVENTS_TYPE_REBUILD 手动重新构建
	EVENTS_TYPE_REBUILD = "rebuild"
)

触发事件

View Source
const (
	GITEE_EVENT                   = "X-Gitee-Event"
	GITEE_EVENT_PUSH              = "Push Hook"
	GITEE_EVENT_NOTE              = "Note Hook"
	GITEE_EVENT_PR                = "Merge Request Hook"
	GITEE_EVENT_PR_ACTION_OPEN    = "open"
	GITEE_EVENT_PR_ACTION_UPDATE  = "update"
	GITEE_EVENT_PR_ACTION_COMMENT = "comment"
)
View Source
const (
	GITHUB_EVENT                   = "X-GitHub-Event"
	GITHUB_EVENT_ISSUE_COMMENT     = "issue_comment"
	GITHUB_EVENT_PUSH              = "push"
	GITHUB_EVENT_PR                = "pull_request"
	GITHUB_EVENT_PR_ACTION_OPEN    = "open"
	GITHUB_EVENT_PR_ACTION_UPDATE  = "update"
	GITHUB_EVENT_PR_ACTION_COMMENT = "comment"
)
View Source
const (
	GITLAB_EVENT      = "X-Gitlab-Event"
	GITLAB_EVENT_PUSH = "Push Hook"
	GITLAB_EVENT_PR   = "Merge Request Hook"
	GITLAB_EVENT_NOTE = "Note Hook"
)
View Source
const (
	GITEA_EVENT      = "X-Gitea-Event"
	GITEA_EVENT_PUSH = "push"
	GITEA_EVENT_PR   = "pull_request"
	GITEA_EVENT_NOTE = "issue_comment"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action int

type BranchHook

type BranchHook struct {
	Ref    Reference
	Repo   Repository
	Sender User
}

BranchHook represents a branch or tag event, eg create and delete github event types.

func (*BranchHook) Repository

func (h *BranchHook) Repository() Repository

type Comment

type Comment struct {
	Body   string
	Author User
}

type Commit

type Commit struct {
	Sha     string
	Message string
	Link    string
}

type PullRequest

type PullRequest struct {
	Number  int64
	Title   string
	Body    string
	Base    Reference
	Head    Reference
	Author  User
	Created time.Time
	Updated time.Time
}

PullRequest represents a repository pull request.

type PullRequestCommentHook

type PullRequestCommentHook struct {
	Action      string
	Repo        Repository
	TargetRepo  Repository
	PullRequest PullRequest
	Comment     Comment
	Sender      User
}

func (*PullRequestCommentHook) Repository

func (h *PullRequestCommentHook) Repository() Repository

type PullRequestHook

type PullRequestHook struct {
	Action      string
	Repo        Repository
	TargetRepo  Repository
	PullRequest PullRequest
	Sender      User
}

func (*PullRequestHook) Repository

func (h *PullRequestHook) Repository() Repository

type PushHook

type PushHook struct {
	Ref     string
	Repo    Repository
	Before  string
	After   string
	Commit  Commit
	Sender  User
	Commits []Commit
}

func (*PushHook) Repository

func (h *PushHook) Repository() Repository

type Reference

type Reference struct {
	Name string
	Path string
	Sha  string
}

type Repository

type Repository struct {
	Id          string    `json:"id"`
	Ref         string    `json:"ref"`
	Sha         string    `json:"sha"`
	CloneURL    string    `json:"cloneURL"`
	CreatedAt   time.Time `json:"createdAt"`
	Branch      string    `json:"branch"`
	Description string    `json:"description"`
	FullName    string    `json:"fullName"`
	GitHttpURL  string    `json:"gitHttpURL"`
	GitShhURL   string    `json:"gitSshURL"`
	GitSvnURL   string    `json:"gitSvnURL"`
	GitURL      string    `json:"gitURL"`
	HtmlURL     string    `json:"htmlURL"`
	SshURL      string    `json:"sshURL"`
	SvnURL      string    `json:"svnURL"`
	Name        string    `json:"name"`
	Private     bool      `json:"private"`
	URL         string    `json:"url"`
	Owner       string    `json:"owner"`
	RepoType    string    `json:"repoType"`
	RepoOpenid  string    `json:"repoOpenid"`
}

type SecretFunc

type SecretFunc func(webhook WebHook) (string, error)

type User

type User struct {
	UserName string
}

type WebHook

type WebHook interface {
	Repository() Repository
}

type WebhookService

type WebhookService interface {
	Parse(req *http.Request, fn SecretFunc) (WebHook, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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