Documentation
¶
Index ¶
- Constants
- func IsPRBlacklisted(ctx context.Context, pullCtx pull.Context, config Signals) (bool, string, error)
- func IsPRWhitelisted(ctx context.Context, pullCtx pull.Context, config Signals) (bool, string, error)
- func MergePR(ctx context.Context, pullCtx pull.Context, merger Merger, ...) error
- 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, ...) error
- type CommitMessage
- type Config
- type ConfigFetcher
- type FetchedConfig
- type GitHubMerger
- func (m *GitHubMerger) ChangeBase(ctx context.Context, pullCtx pull.Context, dependentPR *github.PullRequest) error
- func (m *GitHubMerger) DeleteHead(ctx context.Context, pullCtx pull.Context) error
- func (m *GitHubMerger) Merge(ctx context.Context, pullCtx pull.Context, method MergeMethod, ...) (string, error)
- type MergeConfig
- type MergeMethod
- type MergeOptions
- type Merger
- type MessageStrategy
- type PushRestrictionMerger
- func (m *PushRestrictionMerger) ChangeBase(ctx context.Context, pullCtx pull.Context, dependentPR *github.PullRequest) error
- func (m *PushRestrictionMerger) DeleteHead(ctx context.Context, pullCtx pull.Context) error
- func (m *PushRestrictionMerger) Merge(ctx context.Context, pullCtx pull.Context, method MergeMethod, ...) (string, error)
- 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" )
const MaxPullRequestPollCount = 5
Variables ¶
This section is empty.
Functions ¶
func IsPRBlacklisted ¶
func IsPRBlacklisted(ctx context.Context, pullCtx pull.Context, config Signals) (bool, string, error)
IsPRBlacklisted returns true if the PR is identified as blacklisted, false otherwise. Additionally, a description of the reason will be returned.
func IsPRWhitelisted ¶
func IsPRWhitelisted(ctx context.Context, pullCtx pull.Context, config Signals) (bool, string, error)
IsPRWhitelisted returns true if the PR is identified as whitelisted, false otherwise. Additionally, a description of the reason will be returned.
func MergePR ¶
func MergePR(ctx context.Context, pullCtx pull.Context, merger Merger, mergeConfig MergeConfig) error
MergePR spawns a goroutine that attempts to merge a pull request. It returns an error if an error occurs while preparing for the merge before starting the goroutine.
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 CommitMessage ¶
type Config ¶
type Config struct { Version int `yaml:"version"` Merge MergeConfig `yaml:"merge"` Update UpdateConfig `yaml:"update"` }
type ConfigFetcher ¶
type ConfigFetcher struct {
// contains filtered or unexported fields
}
func NewConfigFetcher ¶
func NewConfigFetcher(configurationV1Path string, defaultRepositoryConfig *Config) ConfigFetcher
func (*ConfigFetcher) ConfigForPR ¶
func (cf *ConfigFetcher) ConfigForPR(ctx context.Context, client *github.Client, pullCtx pull.Context) (FetchedConfig, error)
ConfigForPR fetches the configuration for a PR. It returns an error only if the existence of the configuration file could not be determined. If the file does not exist or is invalid, the returned error is nil and the appropriate fields are set on the FetchedConfig.
type FetchedConfig ¶
func (FetchedConfig) Invalid ¶
func (fc FetchedConfig) Invalid() bool
func (FetchedConfig) Missing ¶
func (fc FetchedConfig) Missing() bool
func (FetchedConfig) String ¶
func (fc FetchedConfig) String() string
func (FetchedConfig) Valid ¶
func (fc FetchedConfig) Valid() bool
type GitHubMerger ¶
type GitHubMerger struct {
// contains filtered or unexported fields
}
GitHubMerger merges pull requests using a GitHub client.
func (*GitHubMerger) ChangeBase ¶
func (m *GitHubMerger) ChangeBase(ctx context.Context, pullCtx pull.Context, dependentPR *github.PullRequest) error
func (*GitHubMerger) DeleteHead ¶
func (*GitHubMerger) Merge ¶
func (m *GitHubMerger) Merge(ctx context.Context, pullCtx pull.Context, method MergeMethod, msg CommitMessage) (string, error)
type MergeConfig ¶
type MergeConfig struct { Whitelist Signals `yaml:"whitelist"` Blacklist Signals `yaml:"blacklist"` DeleteAfterMerge bool `yaml:"delete_after_merge"` RetargetDependentPullRequests bool `yaml:"retarget_dependent_pull_requests"` Method MergeMethod `yaml:"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
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 // ChangeBase changes the base of a dependent PR to a base of main PR ChangeBase(ctx context.Context, pullCtx pull.Context, dependentPR *github.PullRequest) error }
func NewGitHubMerger ¶
type MessageStrategy ¶
type MessageStrategy string
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) ChangeBase ¶
func (m *PushRestrictionMerger) ChangeBase(ctx context.Context, pullCtx pull.Context, dependentPR *github.PullRequest) error
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 []string `yaml:"labels"` CommentSubstrings []string `yaml:"comment_substrings"` Comments []string `yaml:"comments"` PRBodySubstrings []string `yaml:"pr_body_substrings"` Branches []string `yaml:"branches"` }
func (*Signals) Matches ¶
func (s *Signals) Matches(ctx context.Context, pullCtx pull.Context, tag string) (bool, string, error)
Matches 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 (whitelist, blacklist) this set of signals is associated with.
type SquashOptions ¶
type SquashOptions struct { Title TitleStrategy `yaml:"title"` Body MessageStrategy `yaml:"body"` MessageEndMarkerRx string `yaml:"message_end_marker_rx"` MessageEndMarker string `yaml:"message_end_marker"` MessageDelimiter string `yaml:"message_delimiter"` }
type TitleStrategy ¶
type TitleStrategy string
type UpdateConfig ¶
type UpdateConfig struct { Whitelist Signals `yaml:"whitelist"` Blacklist Signals `yaml:"blacklist"` // Status checks to require for update RequiredStatuses []string `yaml:"required_statuses"` RequiredStatusesDescriptionWhitelist map[string][]string `yaml:"required_statuses_description_whitelist"` DraftUpdate bool `yaml:"draft_update"` }