Documentation
¶
Overview ¶
Package gitlab contains support types for gitlab interaction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PushPayload ¶
type PushPayload struct {
After string `json:"after"`
Before string `json:"before"`
CheckoutSha string `json:"checkout_sha"`
Commits []struct {
Added []interface{} `json:"added"`
Author struct {
Email string `json:"email"`
Name string `json:"name"`
} `json:"author"`
Id string `json:"id"`
Message string `json:"message"`
Modified []string `json:"modified"`
Removed []interface{} `json:"removed"`
Timestamp string `json:"timestamp"`
Url string `json:"url"`
} `json:"commits"`
EventName string `json:"event_name"`
Message interface{} `json:"message"`
ObjectKind string `json:"object_kind"`
Project struct {
AvatarUrl interface{} `json:"avatar_url"`
CiConfigPath interface{} `json:"ci_config_path"`
DefaultBranch string `json:"default_branch"`
Description string `json:"description"`
GitHttpUrl string `json:"git_http_url"`
GitSshUrl string `json:"git_ssh_url"`
Homepage string `json:"homepage"`
HttpUrl string `json:"http_url"`
Id int64 `json:"id"`
Name string `json:"name"`
Namespace string `json:"namespace"`
PathWithNamespace string `json:"path_with_namespace"`
SshUrl string `json:"ssh_url"`
Url string `json:"url"`
VisibilityLevel int64 `json:"visibility_level"`
WebUrl string `json:"web_url"`
} `json:"project"`
ProjectId int64 `json:"project_id"`
Ref string `json:"ref"`
Repository struct {
Description string `json:"description"`
GitHttpUrl string `json:"git_http_url"`
GitSshUrl string `json:"git_ssh_url"`
Homepage string `json:"homepage"`
Name string `json:"name"`
Url string `json:"url"`
VisibilityLevel int64 `json:"visibility_level"`
} `json:"repository"`
TotalCommitsCount int64 `json:"total_commits_count"`
UserAvatar string `json:"user_avatar"`
UserEmail string `json:"user_email"`
UserId int64 `json:"user_id"`
UserName string `json:"user_name"`
UserUsername string `json:"user_username"`
}
PushPayload delivered on push and web edits. This is the whole response, we are mainly interested in the modified files in a commit.
func (PushPayload) IsFileModified ¶
func (p PushPayload) IsFileModified(filename string) bool
IsFileModified returns true, if given file has been modified.
func (PushPayload) MatchModified ¶
func (p PushPayload) MatchModified(re *regexp.Regexp) (filenames []string)
MatchModified returns a list of paths matching a pattern (match against the full path in repo, e.g. docs/review.*).
func (PushPayload) ModifiedFiles ¶
func (p PushPayload) ModifiedFiles() (filenames []string)
ModifiedFiles returns all modified files across all commits in this payload.
type Repo ¶
Repo connects a remote git repository to a local clone. Remote authentification via token (e.g. in gitlab) supported.
func (Repo) AuthURL ¶
AuthURL returns an authenticated repository URL, if no token is supplied, just return the repo URL as is.
func (Repo) Update ¶
Update runs a git pull (or clone), as per strong convention, this will always be a fast forward. If repo does not exist yet, clone. gitlab/profile/personal_access_tokens: You can also use personal access tokens to authenticate against Git over HTTP. They are the only accepted password when you have Two-Factor Authentication (2FA) enabled.