handler

package
v0.0.0-...-38d5e0a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// PostMergeCherryPickCommand is the built-in command for post-merge cherry-pick operations
	PostMergeCherryPickCommand = "__post-merge-cherry-pick"
)

Built-in command constants

Variables

This section is empty.

Functions

func IsBuiltInCommand

func IsBuiltInCommand(command string) bool

IsBuiltInCommand returns true if the command is a built-in command (starts with __)

Types

type CommandHandler

type CommandHandler func(args []string) error

CommandHandler defines the interface for command handlers

type CommentedError

type CommentedError struct {
	Err error
}

CommentedError represents an error where a comment has already been posted to the PR

func (*CommentedError) Error

func (e *CommentedError) Error() string

func (*CommentedError) Unwrap

func (e *CommentedError) Unwrap() error

type PRHandler

type PRHandler struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

PRHandler encapsulates Git client and configuration for PR operations

func NewPRHandler

func NewPRHandler(logger *logrus.Logger, cfg *config.Config) (*PRHandler, error)

NewPRHandler creates a new PR handler with Git client and configuration

func NewPRHandlerWithClient

func NewPRHandlerWithClient(logger *logrus.Logger, cfg *config.Config, client git.GitClient, prSender string) (*PRHandler, error)

NewPRHandlerWithClient creates a new PR handler with a provided client (for testing)

func (*PRHandler) CheckPRStatus

func (h *PRHandler) CheckPRStatus(expectedState string) error

CheckPRStatus verifies if the PR is in the expected state

func (*PRHandler) ExecuteCommand

func (h *PRHandler) ExecuteCommand(command string, args []string) error

ExecuteCommand executes a command with the given arguments This is the unified command execution method used by regular, sub-command, and built-in command flows

func (*PRHandler) ExposedDetermineMergeMethod

func (h *PRHandler) ExposedDetermineMergeMethod(args []string) string

ExposedDetermineMergeMethod exposes determineMergeMethod for testing

func (*PRHandler) ExposedSelectAutoMergeMethod

func (h *PRHandler) ExposedSelectAutoMergeMethod() string

ExposedSelectAutoMergeMethod exposes selectAutoMergeMethod for testing

func (*PRHandler) ExposedValidateRebaseMerge

func (h *PRHandler) ExposedValidateRebaseMerge() error

ExposedValidateRebaseMerge exposes validateRebaseMerge for testing

func (*PRHandler) GetCommentsWithCache

func (h *PRHandler) GetCommentsWithCache() ([]git.Comment, error)

GetCommentsWithCache retrieves all comments from the pull request with caching

func (*PRHandler) GetLGTMVotes

func (h *PRHandler) GetLGTMVotes(requiredPerms []string, debugMode bool, ignoreUserRemove ...string) (int, map[string]string, error)

GetLGTMVotes retrieves and validates LGTM votes with optimized comments caching

func (*PRHandler) HandleAssign

func (h *PRHandler) HandleAssign(users []string) error

HandleAssign assigns users as reviewers to the PR

func (*PRHandler) HandleBatch

func (h *PRHandler) HandleBatch(args []string) error

HandleBatch executes multiple commands in batch mode

func (*PRHandler) HandleCheck

func (h *PRHandler) HandleCheck(args []string) error

HandleCheck displays current LGTM status or executes sub-commands

func (*PRHandler) HandleCheckbox

func (h *PRHandler) HandleCheckbox(args []string) error

HandleCheckbox updates unchecked checkboxes in the PR description.

func (*PRHandler) HandleCheckboxIssue

func (h *PRHandler) HandleCheckboxIssue(args []string) error

HandleCheckboxIssue updates unchecked checkboxes in the specified or default GitHub issue.

func (*PRHandler) HandleCherrypick

func (h *PRHandler) HandleCherrypick(args []string) error

HandleCherrypick handles the cherrypick command to create a cherrypick PR to a different branch

func (*PRHandler) HandleClose

func (h *PRHandler) HandleClose(args []string) error

HandleClose closes the PR without merging

func (*PRHandler) HandleHelp

func (h *PRHandler) HandleHelp(_ []string) error

HandleHelp displays available commands in GitHub Markdown table format

func (*PRHandler) HandleLGTM

func (h *PRHandler) HandleLGTM(_ []string) error

HandleLGTM processes LGTM votes and approves PR if threshold is met

func (*PRHandler) HandleLabel

func (h *PRHandler) HandleLabel(labels []string) error

HandleLabel adds labels to the PR

func (*PRHandler) HandleMerge

func (h *PRHandler) HandleMerge(args []string) error

HandleMerge merges the PR if conditions are met

func (*PRHandler) HandlePostMergeCherryPick

func (h *PRHandler) HandlePostMergeCherryPick() error

HandlePostMergeCherryPick processes any cherry-pick commands found in PR comments after merge This is a public method that can be called independently for post-merge operations

func (*PRHandler) HandleRebase

func (h *PRHandler) HandleRebase(_ []string) error

HandleRebase rebases the PR branch

func (*PRHandler) HandleRemoveLGTM

func (h *PRHandler) HandleRemoveLGTM(_ []string) error

HandleRemoveLGTM processes the removal of LGTM by dismissing approval if threshold was met

func (*PRHandler) HandleRetest

func (h *PRHandler) HandleRetest(args []string) error

HandleRetest reruns failed test jobs by commenting /test {pipeline-name}

func (*PRHandler) HandleUnassign

func (h *PRHandler) HandleUnassign(users []string) error

HandleUnassign removes users from PR reviewers

func (*PRHandler) HandleUnlabel

func (h *PRHandler) HandleUnlabel(labels []string) error

HandleUnlabel removes labels from the PR

func (*PRHandler) PostComment

func (h *PRHandler) PostComment(message string) error

PostComment posts a comment to the pull request

type RemovalResult

type RemovalResult struct {
	CurrentUserHasVote bool
	BeforeVotes        int
	AfterVotes         int
	UserPermission     string
}

RemovalResult holds the result of LGTM removal processing

type SubCommand

type SubCommand struct {
	Command string
	Args    []string
}

SubCommand represents a parsed sub-command with its arguments

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL