worker

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigHeader

type ConfigHeader struct {
	Version int `yaml:"version"`
}

type ConfigV1

type ConfigV1 struct {
	ConfigHeader
	Merge  MergeConfigV1  `yaml:"merge"`
	Update UpdateConfigV1 `yaml:"update"`
}

type IgnoreConfig

type IgnoreConfig struct {
	IgnoreFromUsers  common.RegexSlice `yaml:"ignoreFromUsers"`
	IgnoreWithTitles common.RegexSlice `yaml:"ignoreWithTitles"`
	// contains filtered or unexported fields
}

func (*IgnoreConfig) IsLabelIgnored

func (c *IgnoreConfig) IsLabelIgnored(s string) string

func (*IgnoreConfig) IsTitleIgnored

func (c *IgnoreConfig) IsTitleIgnored(s string) string

func (*IgnoreConfig) IsUserIgnored

func (c *IgnoreConfig) IsUserIgnored(s string) string

type MergeConfigV1

type MergeConfigV1 struct {
	Labels               common.RegexSlice `yaml:"labels"`
	Strategy             MergeStrategy     `yaml:"strategy"`
	RequiredApprovals    int               `yaml:"requiredApprovals"`
	RequireApprovalsFrom common.RegexSlice `yaml:"requireApprovalsFrom"`
	RequiredChecks       common.RegexSlice `yaml:"requiredChecks"`
	RequireLinearHistory bool              `yaml:"requireLinearHistory"`
	DeleteBranch         bool              `yaml:"deleteBranch"`
	IgnoreConfig
}

type MergeStrategy

type MergeStrategy string
const (
	MergeCommitStrategy MergeStrategy = "commit"
	SquashMergeStrategy MergeStrategy = "squash"
	RebaseMergeStrategy MergeStrategy = "rebase"
)

func (MergeStrategy) GithubString

func (s MergeStrategy) GithubString() string

type UpdateConfigV1

type UpdateConfigV1 struct {
	Labels common.RegexSlice `yaml:"labels"`
	IgnoreConfig
}

type Worker

type Worker struct {
	Logger  *zerolog.Logger
	BotName string

	AllowedRepositories         common.RegexSlice
	AllowOnlyPublicRepositories bool

	PushSubscription        *nats.Subscription
	PullRequestSubscription *nats.Subscription

	AccessTokensKV nats.KeyValue
	ConfigsKV      nats.KeyValue
	CheckRunsKV    nats.KeyValue

	JetStreamContext   nats.JetStreamContext
	PullRequestSubject string
	RetryWait          time.Duration

	MaxDurationForPushWorker        time.Duration
	MaxDurationForPullRequestWorker time.Duration

	RateLimitKV       nats.KeyValue
	RateLimitInterval time.Duration

	DurationBeforeMergeAfterCheck       time.Duration
	DurationToWaitAfterUpdateBranch     time.Duration
	MessageChannelSizePerSubjectSetting int

	HTTPClient *http.Client

	AppID      int64
	PrivateKey []byte
	// contains filtered or unexported fields
}

func (*Worker) Consume

func (worker *Worker) Consume() error

func (*Worker) CreateOrUpdateCheckRun

func (worker *Worker) CreateOrUpdateCheckRun(
	ctx context.Context,
	rootLogger *zerolog.Logger,
	accessToken string,
	repository *common.Repository,
	pullRequestNodeID,
	sha,
	status,
	title,
	summary string,
) error

func (*Worker) Shutdown

func (worker *Worker) Shutdown(context.Context) error

Jump to

Keyboard shortcuts

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