prwatcher

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package prwatcher monitors open pull requests and auto-merges eligible ones.

Eligibility requires: not draft, trusted author, no excluded labels, all CI checks passed, and mergeable. The watcher runs concurrently with the dispatcher via errgroup.

When trusted reviewers leave unresolved review comments on an eligible PR, the watcher creates a batched remediation issue for the dispatcher to handle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PRTier added in v0.1.11

type PRTier int

PRTier represents the merge policy tier for a pull request.

const (
	// PRTierUnknown is the default when classification cannot determine a tier.
	PRTierUnknown PRTier = iota
	// PRTier1 is for docs, config, chores — auto-merge immediately on CI green.
	PRTier1
	// PRTier2 is for features, fixes, refactoring — auto-merge after delay.
	PRTier2
	// PRTier3 is for architecture, breaking, security — never auto-merge.
	PRTier3
)

func ClassifyPRTier added in v0.1.11

func ClassifyPRTier(pr *forge.PullRequest, issueLabels []string) PRTier

ClassifyPRTier determines the merge policy tier for a pull request. It examines the PR's labels, title, and linked issue labels. The highest matching tier wins (Tier 3 > Tier 2 > Tier 1). issueLabels are the labels from the linked issue (if available).

func (PRTier) Description added in v0.1.11

func (t PRTier) Description() string

Description returns a short explanation of the tier's merge policy.

func (PRTier) String added in v0.1.11

func (t PRTier) String() string

String returns the human-readable tier name.

type Watcher

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

Watcher polls open PRs and auto-merges eligible ones.

func New

func New(pm forge.PullRequestManager, issues forge.IssueTracker, cfg autonomy.MergeConfig, interval time.Duration, logger *zap.Logger) *Watcher

New creates a Watcher with the given PR manager, issue tracker, and merge policy. The issue tracker is used to create remediation issues for PRs with blocking review comments. It may be nil to disable remediation.

func (*Watcher) Run

func (w *Watcher) Run(ctx context.Context) error

Run polls open PRs at the configured interval until the context is cancelled.

Jump to

Keyboard shortcuts

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