Documentation ¶
Index ¶
- Constants
- func IsMergeMethodTriggered(ctx context.Context, pullCtx pull.Context, config Signals) (bool, string, error)
- func IsPRIgnored(ctx context.Context, pullCtx pull.Context, config Signals) (bool, string, error)
- func IsPRTriggered(ctx context.Context, pullCtx pull.Context, config Signals) (bool, string, error)
- func MergePR(ctx context.Context, pullCtx pull.Context, merger Merger, ...)
- func ShouldMergePR(ctx context.Context, pullCtx pull.Context, mergeConfig MergeConfig) (bool, error)
- func ShouldUpdatePR(ctx context.Context, pullCtx pull.Context, updateConfig UpdateConfig) (bool, error)
- func UpdatePR(ctx context.Context, pullCtx pull.Context, client *github.Client, ...) bool
- type AutoMergeSignal
- type BranchPatternsSignal
- type BranchesSignal
- type CommentSubstringsSignal
- type CommentsSignal
- type CommitMessage
- type ConditionalMergeMethod
- type Config
- type ConfigV0
- type GitHubMerger
- type LabelsSignal
- type MaxCommitsSignal
- type MergeConfig
- type MergeMethod
- type MergeOptions
- type Merger
- type MessageStrategy
- type ModeV0
- type PRBodySubstringsSignal
- type PushRestrictionMerger
- type Signal
- type Signals
- type SquashOptions
- type TitleStrategy
- type UpdateConfig
Constants ¶
const ( PullRequestBody MessageStrategy = "pull_request_body" SummarizeCommits MessageStrategy = "summarize_commits" EmptyBody MessageStrategy = "empty_body" PullRequestTitle TitleStrategy = "pull_request_title" FirstCommitTitle TitleStrategy = "first_commit_title" GithubDefaultTitle TitleStrategy = "github_default" MergeCommit MergeMethod = "merge" SquashAndMerge MergeMethod = "squash" RebaseAndMerge MergeMethod = "rebase" FastForwardOnly MergeMethod = "ff-only" )
const MaxPullRequestPollCount = 5
Variables ¶
This section is empty.
Functions ¶
func IsMergeMethodTriggered ¶ added in v1.15.0
func IsMergeMethodTriggered(ctx context.Context, pullCtx pull.Context, config Signals) (bool, string, error)
IsMergeMethodTriggered returns true if ALL signals are fully matched, false otherwise. Additionally, a description of the reason will be returned.
func IsPRIgnored ¶ added in v1.10.0
IsPRIgnored returns true if the PR is identified as ignored, false otherwise. Additionally, a description of the reason will be returned.
func IsPRTriggered ¶ added in v1.10.0
IsPRTriggered returns true if the PR is identified as triggered, false otherwise. Additionally, a description of the reason will be returned.
func MergePR ¶
MergePR merges a pull request if all conditions are met. It logs any errors that it encounters.
func ShouldMergePR ¶
func ShouldMergePR(ctx context.Context, pullCtx pull.Context, mergeConfig MergeConfig) (bool, error)
ShouldMergePR TODO: may want to return a richer type than bool
func ShouldUpdatePR ¶
Types ¶
type AutoMergeSignal ¶ added in v1.16.0
type AutoMergeSignal bool
func (AutoMergeSignal) Enabled ¶ added in v1.16.0
func (signal AutoMergeSignal) Enabled() bool
type BranchPatternsSignal ¶ added in v1.15.0
type BranchPatternsSignal []string
func (BranchPatternsSignal) Enabled ¶ added in v1.15.0
func (signal BranchPatternsSignal) Enabled() bool
func (BranchPatternsSignal) Matches ¶ added in v1.15.0
func (signal BranchPatternsSignal) Matches(ctx context.Context, pullCtx pull.Context, tag string) (bool, string, error)
Matches Determines which branch pattern signals match the given PR. It returns: - A boolean to indicate if a signal matched - A description of the first matched signal
type BranchesSignal ¶ added in v1.15.0
type BranchesSignal []string
func (BranchesSignal) Enabled ¶ added in v1.15.0
func (signal BranchesSignal) Enabled() bool
func (BranchesSignal) Matches ¶ added in v1.15.0
func (signal BranchesSignal) Matches(ctx context.Context, pullCtx pull.Context, tag string) (bool, string, error)
Matches Determines which branch signals match the given PR. It returns: - A boolean to indicate if a signal matched - A description of the first matched signal
type CommentSubstringsSignal ¶ added in v1.15.0
type CommentSubstringsSignal []string
func (CommentSubstringsSignal) Enabled ¶ added in v1.15.0
func (signal CommentSubstringsSignal) Enabled() bool
func (CommentSubstringsSignal) Matches ¶ added in v1.15.0
func (signal CommentSubstringsSignal) Matches(ctx context.Context, pullCtx pull.Context, tag string) (bool, string, error)
Matches Determines which comment substring signals match the given PR. It returns: - A boolean to indicate if a signal matched - A description of the first matched signal
type CommentsSignal ¶ added in v1.15.0
type CommentsSignal []string
func (CommentsSignal) Enabled ¶ added in v1.15.0
func (signal CommentsSignal) Enabled() bool
func (CommentsSignal) Matches ¶ added in v1.15.0
func (signal CommentsSignal) Matches(ctx context.Context, pullCtx pull.Context, tag string) (bool, string, error)
Matches Determines which comment signals match the given PR. It returns: - A boolean to indicate if a signal matched - A description of the first matched signal
type CommitMessage ¶
type ConditionalMergeMethod ¶ added in v1.15.0
type ConditionalMergeMethod struct { Method MergeMethod `yaml:"method"` Trigger Signals `yaml:"trigger"` }
type Config ¶
type Config struct { Version int `yaml:"version"` Merge MergeConfig `yaml:"merge"` Update UpdateConfig `yaml:"update"` }
func ParseConfig ¶ added in v1.14.0
type ConfigV0 ¶
type ConfigV0 struct { Mode ModeV0 `yaml:"mode"` Strategy MergeMethod `yaml:"strategy"` DeleteAfterMerge bool `yaml:"deleteAfterMerge"` // this setting is unused, but needs to be present for valid v0 configuration IgnoreSquashedMessages bool `yaml:"ignoreSquashedMessages"` }
type GitHubMerger ¶
type GitHubMerger struct {
// contains filtered or unexported fields
}
GitHubMerger merges pull requests using a GitHub client.
func (*GitHubMerger) DeleteHead ¶
func (*GitHubMerger) Merge ¶
func (m *GitHubMerger) Merge(ctx context.Context, pullCtx pull.Context, method MergeMethod, msg CommitMessage) (string, error)
type LabelsSignal ¶ added in v1.15.0
type LabelsSignal []string
func (LabelsSignal) Enabled ¶ added in v1.15.0
func (signal LabelsSignal) Enabled() bool
func (LabelsSignal) Matches ¶ added in v1.15.0
func (signal LabelsSignal) Matches(ctx context.Context, pullCtx pull.Context, tag string) (bool, string, error)
Matches Determines which label signals match the given PR. It returns: - A boolean to indicate if a signal matched - A description of the first matched signal
type MaxCommitsSignal ¶ added in v1.15.0
type MaxCommitsSignal int
func (MaxCommitsSignal) Enabled ¶ added in v1.15.0
func (signal MaxCommitsSignal) Enabled() bool
func (MaxCommitsSignal) Matches ¶ added in v1.15.0
func (signal MaxCommitsSignal) Matches(ctx context.Context, pullCtx pull.Context, tag string) (bool, string, error)
Matches Determines if the number of commits in a PR is at or below a given max. It returns: - An empty list if there is no match, otherwise a single string description of the match - A match value of 0 if there is no match, otherwise the value of the max commits signal
type MergeConfig ¶
type MergeConfig struct { Trigger Signals `yaml:"trigger"` Ignore Signals `yaml:"ignore"` // Blacklist and Whitelist are legacy options that will be disabled in a future v2 format Blacklist Signals `yaml:"blacklist"` Whitelist Signals `yaml:"whitelist"` DeleteAfterMerge bool `yaml:"delete_after_merge"` AllowMergeWithNoChecks bool `yaml:"allow_merge_with_no_checks"` Method MergeMethod `yaml:"method"` MergeMethods []ConditionalMergeMethod `yaml:"merge_method"` Options MergeOptions `yaml:"options"` BranchMethod map[string]MergeMethod `yaml:"branch_method"` // Additional status checks that bulldozer should require // (even if the branch protection settings doesn't require it) RequiredStatuses []string `yaml:"required_statuses"` }
type MergeMethod ¶
type MergeMethod string
func DetermineMergeMethod ¶ added in v1.15.0
func DetermineMergeMethod(ctx context.Context, pullCtx pull.Context, mergeConfig MergeConfig) (MergeMethod, error)
DetermineMergeMethod determines which merge method to use when merging the PR
type MergeOptions ¶
type MergeOptions struct {
Squash *SquashOptions `yaml:"squash"`
}
type Merger ¶
type Merger interface { // Merge merges the pull request in the context using the commit message // and options. It returns the SHA of the merge commit on success. Merge(ctx context.Context, pullCtx pull.Context, method MergeMethod, msg CommitMessage) (string, error) // DeleteHead deletes the head branch of the pull request in the context. DeleteHead(ctx context.Context, pullCtx pull.Context) error }
func NewGitHubMerger ¶
type MessageStrategy ¶
type MessageStrategy string
type PRBodySubstringsSignal ¶ added in v1.15.0
type PRBodySubstringsSignal []string
func (PRBodySubstringsSignal) Enabled ¶ added in v1.15.0
func (signal PRBodySubstringsSignal) Enabled() bool
func (PRBodySubstringsSignal) Matches ¶ added in v1.15.0
func (signal PRBodySubstringsSignal) Matches(ctx context.Context, pullCtx pull.Context, tag string) (bool, string, error)
Matches Determines which PR body signals match the given PR. It returns: - A boolean to indicate if a signal matched - A description of the first matched signal
type PushRestrictionMerger ¶
PushRestrictionMerger delegates merge operations to different Mergers based on whether or not the pull requests targets a branch with push restrictions.
func (*PushRestrictionMerger) DeleteHead ¶
func (*PushRestrictionMerger) Merge ¶
func (m *PushRestrictionMerger) Merge(ctx context.Context, pullCtx pull.Context, method MergeMethod, msg CommitMessage) (string, error)
type Signals ¶
type Signals struct { Labels LabelsSignal `yaml:"labels"` CommentSubstrings CommentSubstringsSignal `yaml:"comment_substrings"` Comments CommentsSignal `yaml:"comments"` PRBodySubstrings PRBodySubstringsSignal `yaml:"pr_body_substrings"` Branches BranchesSignal `yaml:"branches"` BranchPatterns BranchPatternsSignal `yaml:"branch_patterns"` MaxCommits MaxCommitsSignal `yaml:"max_commits"` AutoMerge AutoMergeSignal `yaml:"auto_merge"` }
func (Signals) MatchesAll ¶ added in v1.15.0
func (s Signals) MatchesAll(ctx context.Context, pullCtx pull.Context, tag string) (bool, string, error)
MatchesAll returns true if the pull request matches ALL of the signals. It also returns a description of the match status. The tag argument appears in this description and indicates the behavior (trigger, ignore) this set of signals is associated with.
func (Signals) MatchesAny ¶ added in v1.15.0
func (s Signals) MatchesAny(ctx context.Context, pullCtx pull.Context, tag string) (bool, string, error)
MatchesAny returns true if the pull request meets one or more signals. It also returns a description of the signal that was met. The tag argument appears in this description and indicates the behavior (trigger, ignore) this set of signals is associated with.
type SquashOptions ¶
type SquashOptions struct { Title TitleStrategy `yaml:"title"` Body MessageStrategy `yaml:"body"` MessageDelimiter string `yaml:"message_delimiter"` }
type TitleStrategy ¶
type TitleStrategy string
type UpdateConfig ¶
type UpdateConfig struct { Trigger Signals `yaml:"trigger"` Ignore Signals `yaml:"ignore"` IgnoreDrafts *bool `yaml:"ignore_drafts"` // Additional status checks that bulldozer should require // (even if the branch protection settings doesn't require it) RequiredStatuses []string `yaml:"required_statuses"` // Blacklist and Whitelist are legacy options that will be disabled in a future v2 format Blacklist Signals `yaml:"blacklist"` Whitelist Signals `yaml:"whitelist"` }