forge

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 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 defines the forge-neutral vocabulary shared by the GitHub and GitLab clients and the cleanup engine: which project a remote names, and which pull or merge requests a commit belongs to.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrProjectNotFound reports that the forge has no such project, or
	// that the credentials in use cannot see it.
	ErrProjectNotFound = errors.New("project not found")
	// ErrCommitUnknown reports that the project does not hold the commit,
	// typically because it was never pushed there.
	ErrCommitUnknown = errors.New("commit unknown to project")
)

Functions

This section is empty.

Types

type Change

type Change struct {
	// Number is the PR number or the MR iid.
	Number int
	State  State
	// Head is the full SHA of the change's head commit.
	Head string
	// URL is the change's web page.
	URL string
}

Change is a GitHub pull request or a GitLab merge request.

type Kind

type Kind int

Kind identifies the forge software a project is hosted on.

const (
	// GitHub is github.com or a GitHub Enterprise Server host.
	GitHub Kind = iota + 1
	// GitLab is gitlab.com or a self-managed GitLab host.
	GitLab
)

func (Kind) String

func (k Kind) String() string

String returns the forge name.

type Project

type Project struct {
	Kind Kind
	// Host is the forge's hostname, without scheme or port.
	Host string
	// Path is the repository's full path on that host: "owner/repo" on
	// GitHub, "group/subgroup/project" on GitLab.
	Path string
}

Project is one repository on a forge.

func (Project) String

func (p Project) String() string

String returns the project as host/path.

type State

type State int

State is the lifecycle state of a pull or merge request.

const (
	// Open covers every state in which the change may still merge,
	// including GitLab's locked.
	Open State = iota + 1
	// Merged means the change was merged.
	Merged
	// Closed means the change was closed without merging.
	Closed
)

func (State) String

func (s State) String() string

String returns the lowercase state name.

Directories

Path Synopsis
Package github answers the cleanup engine's forge questions against the GitHub REST API: whether a project exists, its default branch, which pull requests contain a commit, and whether one commit contains another.
Package github answers the cleanup engine's forge questions against the GitHub REST API: whether a project exists, its default branch, which pull requests contain a commit, and whether one commit contains another.
Package gitlab answers the cleanup engine's forge questions — does a project exist, which merge requests contain a commit, does one commit contain another — against the GitLab REST API, with credentials taken from the environment or glab's config file.
Package gitlab answers the cleanup engine's forge questions — does a project exist, which merge requests contain a commit, does one commit contain another — against the GitLab REST API, with credentials taken from the environment or glab's config file.

Jump to

Keyboard shortcuts

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