forge

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 3 Imported by: 1 module, 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

Overview

Package forge is the port for pull-request operations. It is vendor neutral: GitHub via gh, GitHub via the REST API and GitLab are adapters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePR

type CreatePR struct {
	Head, Base  string
	Title, Body string
	Draft       bool
}

CreatePR describes a new pull request.

type Forge

type Forge interface {
	// ListPRs returns every pull request whose head is a branch of this
	// repository, in one call.
	ListPRs(ctx context.Context, repo git.Repo) ([]PullRequest, error)
	CreatePR(ctx context.Context, repo git.Repo, in CreatePR) (PullRequest, error)
	UpdatePR(ctx context.Context, repo git.Repo, number int, in UpdatePR) error
}

Forge performs pull-request operations for the repository's remote.

type PullRequest

type PullRequest struct {
	Number    int       `json:"number"`
	URL       string    `json:"url"`
	Title     string    `json:"title"`
	Body      string    `json:"body,omitempty"`
	State     State     `json:"state"`
	Head      string    `json:"head"`
	Base      string    `json:"base"`
	UpdatedAt time.Time `json:"updatedAt"`
}

PullRequest is a forge-neutral pull request.

type State

type State string

State of a pull request.

const (
	StateOpen   State = "open"
	StateDraft  State = "draft"
	StateMerged State = "merged"
	StateClosed State = "closed"
	// StateUnknown is used when only a number is known (e.g. from a backend
	// snapshot) and the forge has not been consulted.
	StateUnknown State = ""
)

type UpdatePR

type UpdatePR struct {
	Title *string
	Body  *string
	Base  *string
	// Ready marks a draft ready for review when true.
	Ready *bool
}

UpdatePR carries optional changes; nil fields are left untouched.

Directories

Path Synopsis
Package github implements forge.Forge with the gh CLI.
Package github implements forge.Forge with the gh CLI.

Jump to

Keyboard shortcuts

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