Documentation
¶
Index ¶
Constants ¶
View Source
const (
// SemanticPullRequestsKey is the http.Request context key containing the initialized SemanticPullRequests.
SemanticPullRequestsKey contextKey = 0
)
Variables ¶
View Source
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 HandlePullRequestUpdate ¶
func HandlePullRequestUpdate(w http.ResponseWriter, r *http.Request)
HandlePullRequestUpdate handles pull-request update events.
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) 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.
Click to show internal directories.
Click to hide internal directories.