cmd

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: May 9, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyRepositoriesFilePath = fmt.Errorf("empty repositories file path")
)
View Source
var Logger *slog.Logger

Functions

func CombinePRsWithStats added in v0.0.10

func CombinePRsWithStats(ctx context.Context, graphQlClient *api.GraphQLClient, restClient RESTClientInterface, opts CombineOpts) (combined []string, mergeConflicts []string, combinedPRLink string, err error)

CombinePRsWithStats combines PRs and returns stats for summary output

func GetPRStatusInfo added in v0.0.2

func GetPRStatusInfo(ctx context.Context, graphQlClient *api.GraphQLClient, owner, repo string, prNumber int) (*prStatusResponse, error)

GetPRStatusInfo fetches both CI status and approval status using GitHub's GraphQL API

func NewRootCmd

func NewRootCmd() *cobra.Command

NewRootCmd creates the root command for the gh-combine CLI

func ParseRepositories

func ParseRepositories(args []string, path string) ([]github.Repo, error)

func PrMatchesCriteria

func PrMatchesCriteria(branch string, prLabels []string) bool

checks if a PR matches all filtering criteria

func PrMeetsRequirements added in v0.0.2

func PrMeetsRequirements(ctx context.Context, graphQlClient *api.GraphQLClient, owner, repo string, prNumber int) (bool, error)

PrMeetsRequirements checks if a PR meets additional requirements beyond basic criteria

func Run

func Run() error

Run executes the main functionality of the application

func SetupSignalContext

func SetupSignalContext() (context.Context, context.CancelFunc)

SetupSignalContext creates a context that's cancelled on SIGINT or SIGTERM

func ValidateInputs

func ValidateInputs(args []string) error

validateInputs checks if the provided inputs are valid

func ValidateLabels added in v0.0.7

func ValidateLabels(selectLabels []string, ignoreLabels []string) error

Types

type CombineOpts added in v0.0.12

type CombineOpts struct {
	Noop    bool
	Command string
	Repo    github.Repo
	Pulls   github.Pulls
}

CombineOpts holds options for combining PRs Use this struct to pass options to CombinePRsWithStats and related functions This makes the code more maintainable and clear

type MockRESTClient added in v0.0.10

type MockRESTClient struct {
	PostFunc   func(endpoint string, body interface{}, response interface{}) error
	GetFunc    func(endpoint string, response interface{}) error
	DeleteFunc func(endpoint string, response interface{}) error
	PatchFunc  func(endpoint string, body io.Reader, response interface{}) error
}

func (*MockRESTClient) Delete added in v0.0.10

func (m *MockRESTClient) Delete(endpoint string, response interface{}) error

func (*MockRESTClient) Do added in v0.0.10

func (m *MockRESTClient) Do(method string, path string, body io.Reader, response interface{}) error

func (*MockRESTClient) DoWithContext added in v0.0.10

func (m *MockRESTClient) DoWithContext(ctx context.Context, method string, path string, body io.Reader, response interface{}) error

func (*MockRESTClient) Get added in v0.0.10

func (m *MockRESTClient) Get(endpoint string, response interface{}) error

func (*MockRESTClient) Patch added in v0.0.10

func (m *MockRESTClient) Patch(endpoint string, body io.Reader, response interface{}) error

Updated the Patch method to match the RESTClientInterface signature

func (*MockRESTClient) Post added in v0.0.10

func (m *MockRESTClient) Post(endpoint string, body io.Reader, response interface{}) error

Updated the Post method to match the RESTClientInterface signature

func (*MockRESTClient) Put added in v0.0.10

func (m *MockRESTClient) Put(path string, body io.Reader, resp interface{}) error

func (*MockRESTClient) Request added in v0.0.10

func (m *MockRESTClient) Request(method string, path string, body io.Reader) (*http.Response, error)

func (*MockRESTClient) RequestWithContext added in v0.0.10

func (m *MockRESTClient) RequestWithContext(ctx context.Context, method string, path string, body io.Reader) (*http.Response, error)

type RESTClientInterface added in v0.0.10

type RESTClientInterface interface {
	Post(endpoint string, body io.Reader, response interface{}) error
	Get(endpoint string, response interface{}) error
	Delete(endpoint string, response interface{}) error
	Patch(endpoint string, body io.Reader, response interface{}) error
}

Updated RESTClientInterface to match the method signatures of api.RESTClient

type RepoStats added in v0.0.10

type RepoStats struct {
	RepoName         string
	CombinedCount    int
	SkippedMergeConf int
	SkippedCriteria  int
	CombinedPRLink   string
	NotEnoughPRs     bool
	TotalPRs         int
}

type Spinner

type Spinner struct {
	// contains filtered or unexported fields
}

func NewSpinner

func NewSpinner(message string) *Spinner

func (*Spinner) Stop

func (s *Spinner) Stop()

func (*Spinner) UpdateMessage

func (s *Spinner) UpdateMessage(message string)

UpdateMessage changes the text displayed next to the spinner while it's running

type StatsCollector added in v0.0.10

type StatsCollector struct {
	ReposProcessed          int
	PRsCombined             int
	PRsSkippedMergeConflict int
	PRsSkippedCriteria      int
	PerRepoStats            map[string]*RepoStats
	CombinedPRLinks         []string
	StartTime               time.Time
	EndTime                 time.Time
}

StatsCollector tracks stats for the CLI run

Jump to

Keyboard shortcuts

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