Help us shape the future of Go! Take the 2026 Go Developer Survey

forge

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound     = errors.New("not found")
	ErrTooMany      = errors.New("too many changed files")
	ErrTagElsewhere = errors.New("tag points at another commit")
)

Functions

func SplitRepo

func SplitRepo(repo string) (string, string, error)

Types

type AutoMerger

type AutoMerger interface {
	AutoMerge(ctx context.Context, repo string, n int) error
}

type Change

type Change struct {
	Number   int
	Title    string
	URL      string
	HeadRef  string
	HeadSHA  string
	MergeSHA string
	State    ChangeState
	MergedAt *time.Time
	MergedBy string
	Author   string
}

type ChangeRequest

type ChangeRequest struct {
	Base    string
	Branch  string
	Title   string
	Message string
	Files   map[string][]byte
}

type ChangeState

type ChangeState string
const (
	Open   ChangeState = "open"
	Merged ChangeState = "merged"
	Closed ChangeState = "closed"
)

type Check

type Check struct {
	Name        string
	State       CheckState
	CompletedAt time.Time
}

func Latest

func Latest(checks []Check, name string) (Check, bool)

type CheckState

type CheckState string
const (
	Pending CheckState = "pending"
	Success CheckState = "success"
	Failure CheckState = "failure"
)

type Comment

type Comment struct {
	ID     int64
	Author string
	Body   string
}

type DeployState

type DeployState string
const (
	DeployInProgress DeployState = "in_progress"
	DeploySuccess    DeployState = "success"
	DeployFailure    DeployState = "failure"
	DeployInactive   DeployState = "inactive"
)

type Deployment

type Deployment struct {
	ID          int64
	Environment string
	SHA         string
	State       DeployState
	CreatedAt   time.Time
	Payload     []byte
}

type Deployments

type Deployments interface {
	CreateDeployment(ctx context.Context, repo, environment, sha string, payload []byte) (Deployment, error)
	SetDeploymentState(ctx context.Context, repo string, id int64, state DeployState, logURL string) error
	ListDeployments(ctx context.Context, repo, environment string) iter.Seq2[Deployment, error]
}

type File

type File struct {
	Path   string
	Status string
	Patch  string
}

type Forge

type Forge interface {
	Reader
	Writer
}

type Reader

type Reader interface {
	DefaultBranch(ctx context.Context, repo string) (string, error)
	FileAt(ctx context.Context, repo, path, ref string) ([]byte, error)
	ResolveRef(ctx context.Context, repo, ref string) (string, error)
	ChangedPaths(ctx context.Context, repo, base, head string) ([]string, error)
	Subtrees(ctx context.Context, repo, dir, ref string) (map[string]string, error)
	OpenChanges(ctx context.Context, repo, headPrefix string) ([]Change, error)
	ChangeByHead(ctx context.Context, repo, head string) (Change, bool, error)
	GetChange(ctx context.Context, repo string, n int) (Change, error)
	ChangesForCommit(ctx context.Context, repo, sha string) ([]Change, error)
	ChangeFiles(ctx context.Context, repo string, n int) ([]File, error)
	Checks(ctx context.Context, repo, sha string) ([]Check, error)
	Comments(ctx context.Context, repo string, n int) ([]Comment, error)
	Viewer(ctx context.Context) (string, error)
}

type RepoSettings

type RepoSettings struct {
	Push                *bool
	AutoMerge           *bool
	DeleteBranchOnMerge *bool
}

type Settings

type Settings interface {
	RepoSettings(ctx context.Context, repo string) (RepoSettings, error)
}

type Writer

type Writer interface {
	CreateTag(ctx context.Context, repo, tag, sha string) error
	PushChange(ctx context.Context, repo string, req ChangeRequest) (Change, error)
	CloseChange(ctx context.Context, repo string, n int, deleteBranch bool) error
	CreateComment(ctx context.Context, repo string, n int, body string) (Comment, error)
	UpdateComment(ctx context.Context, repo string, id int64, body string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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