pr

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 6 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 pr names a GitHub pull request.

Index

Constants

View Source
const (
	ReviewApproved         = "APPROVED"
	ReviewChangesRequested = "CHANGES_REQUESTED"
	ReviewCommented        = "COMMENTED"
	ReviewDismissed        = "DISMISSED"
)

The states of a review.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Name    string
	Pending bool
	Failed  bool
	URL     string
	Summary string
}

Check is one status check or check run on the head commit.

type Codec

type Codec struct{}

Codec is the unit codec of provider "github".

func (Codec) Equal added in v0.2.0

func (Codec) Equal(a, b string) bool

Equal folds case, as GitHub compares owners, repositories and logins.

func (Codec) KeyOf added in v0.2.0

func (Codec) KeyOf(raw string) (string, bool)

KeyOf is the key of the pull request a URL names.

func (Codec) Provider

func (Codec) Provider() unit.ProviderID

func (Codec) Target added in v0.2.0

func (Codec) Target() string

Target is how a command line names a pull request: its URL.

func (Codec) URL added in v0.2.0

func (Codec) URL(key string) string

URL is the pull request's address; a key that is not one names none.

func (Codec) Valid

func (Codec) Valid(key string) error

Valid refuses a key that is no pull request: number 0 names none.

type Comment

type Comment struct {
	ID        string
	Author    string
	CreatedAt time.Time
}

type Commit

type Commit struct {
	Oid     string
	Parents int
}

type Facts

type Facts struct {
	Ref
	State             string
	IsDraft           bool
	Title             string
	HeadRefName       string
	BaseRefName       string
	HeadRefOid        string
	IsCrossRepository bool
	// Visibility is the repository's visibility, lower-case: public,
	// private or internal; empty when not read.
	Visibility        string
	Author            string
	AuthorAssociation string
	ReviewDecision    string
	// Mergeable is MERGEABLE, CONFLICTING or UNKNOWN (GitHub computes it
	// lazily); empty when not read.
	Mergeable string
	// ChecksState is the status check rollup of the head commit; empty when
	// the repository has no checks.
	ChecksState string
	// NewestChangesRequestOid is the commit the newest CHANGES_REQUESTED
	// review was left on.
	NewestChangesRequestOid string

	Reviews        []Review
	LatestReviews  []Review
	Comments       []Comment
	ReviewRequests []string
	// ViewerRequested says the viewer's review is requested by name.
	ViewerRequested bool
	Commits         []Commit
	// OpenThreads are the unresolved review threads; ThreadsTotal counts
	// every thread, read or not.
	OpenThreads  []Thread
	ThreadsTotal int
	Checks       []Check
	Labels       []string
}

Facts are a pull request as the decide rules read it.

type Ref

type Ref struct {
	Owner  string `json:"owner"`
	Repo   string `json:"repo"`
	Number int    `json:"number"`
}

func ParseKey

func ParseKey(key string) (Ref, error)

ParseKey parses the key of a github unit, "owner/repo#12".

func ParseURL

func ParseURL(raw string) (Ref, error)

func RefOf added in v0.2.0

func RefOf(u unit.Unit) (Ref, bool)

RefOf is the pull request u names; false for a unit of another provider or a key that names none.

func (Ref) RemoteKey

func (r Ref) RemoteKey() string

RemoteKey is the repository's key among a workspace manager's repositories.

func (Ref) String

func (r Ref) String() string

func (Ref) URL

func (r Ref) URL() string

func (Ref) Unit

func (r Ref) Unit() unit.Unit

Unit is the github unit of the reference; the zero reference is the zero unit.

type Review

type Review struct {
	ID          string
	State       string
	Author      string
	SubmittedAt time.Time
	CommitOid   string
	// HasContent is set by the author queries only. GitHub requires a body or
	// comments on the states other than APPROVED; an approval counts only
	// with inline comments, as reading every body would weigh the query.
	HasContent bool
	// ByViewer is set by the queries that ask GitHub whether the viewer wrote the review.
	ByViewer bool
}

type Thread

type Thread struct {
	LastAuthor string
	LastAt     time.Time
}

Thread is an unresolved review thread, by its last comment.

Jump to

Keyboard shortcuts

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