Documentation
¶
Overview ¶
Package handler provides the internal functionalities of the semantic-pull-requests webhook
Index ¶
- Variables
- func Contains(l []string, s string) bool
- func NewSemanticMachine(conventionalTypes bool) *conventionalcommits.Machine
- type SemanticPullRequests
- func (spr *SemanticPullRequests) AreSemanticCommits(machine *conventionalcommits.Machine, cfg *UserConfig, commits []interface{}) bool
- func (spr *SemanticPullRequests) HandlePullRequestUpdate(w http.ResponseWriter, r *http.Request)
- func (spr *SemanticPullRequests) IsSemanticMessage(machine *conventionalcommits.Machine, cfg *UserConfig, msg string) bool
- type UserConfig
Constants ¶
This section is empty.
Variables ¶
var ( // ErrGettingUserConfig is returned when getting the user config fails. ErrGettingUserConfig = errors.New("error getting user config") // ErrParsingUserConfig is returned when parsing the user config fails. ErrParsingUserConfig = errors.New("error parsing user config") )
Functions ¶
func NewSemanticMachine ¶ added in v1.0.18
func NewSemanticMachine(conventionalTypes bool) *conventionalcommits.Machine
NewSemanticMachine instantiates and returns a new conventionalcommits parser machine.
Types ¶
type SemanticPullRequests ¶
type SemanticPullRequests struct { Client *bitbucket.Client Hook *webhook.Webhook Logger *zap.Logger }
SemanticPullRequests validates Bitbucket pull-requests.
func NewSemanticPullRequests ¶
func NewSemanticPullRequests( username, password string, logger *zap.Logger, ) (*SemanticPullRequests, error)
NewSemanticPullRequests returns an initialized SemanticPullRequests.
func (*SemanticPullRequests) AreSemanticCommits ¶ added in v1.0.7
func (spr *SemanticPullRequests) AreSemanticCommits( machine *conventionalcommits.Machine, cfg *UserConfig, commits []interface{}, ) bool
AreSemanticCommits validates a given list of Bitbucket commits.
func (*SemanticPullRequests) HandlePullRequestUpdate ¶ added in v1.0.113
func (spr *SemanticPullRequests) HandlePullRequestUpdate(w http.ResponseWriter, r *http.Request)
HandlePullRequestUpdate handles pull-request update events.
func (*SemanticPullRequests) IsSemanticMessage ¶
func (spr *SemanticPullRequests) IsSemanticMessage( machine *conventionalcommits.Machine, cfg *UserConfig, msg string, ) bool
IsSemanticMessage validates the semantic of a given message.
type UserConfig ¶
type UserConfig struct { Enabled *bool `yaml:"enabled"` TitleOnly *bool `yaml:"titleOnly"` CommitsOnly *bool `yaml:"commitsOnly"` TitleAndCommits *bool `yaml:"titleAndCommits"` AnyCommit *bool `yaml:"anyCommit"` Scopes *[]string `yaml:"scopes"` Types *[]string `yaml:"types"` AllowMergeCommits *bool `yaml:"allowMergeCommits"` AllowRevertCommits *bool `yaml:"allowRevertCommits"` }
UserConfig represents a repository-level configuration for SemanticPullRequests.
func DefaultUserConfig ¶
func DefaultUserConfig() *UserConfig
DefaultUserConfig returns an initialised UserConfig with default values.
func GetUserConfig ¶
func GetUserConfig(client *bitbucket.Client, owner, repoSlug string) (*UserConfig, error)
GetUserConfig returns the user config for a given repository.