forge

package
v0.58.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 19 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 binds a forge's CLI, gh or glab. Every call goes through Host, so each CLI's spelling is picked in one place and its JSON read into one shape per noun; a non-zero exit is the CLI's own stderr verbatim, since it names the cause better than any paraphrase.

Index

Constants

View Source
const (
	EventOpened          = "opened"
	EventReady           = "ready" // out of draft
	EventCommit          = "commit"
	EventMergeFromBase   = "merge-from-base" // a commit with more than one parent
	EventForcePush       = "force-push"
	EventReview          = "review"
	EventReviewRequested = "review-requested"
	EventMerged          = "merged"
	EventClosed          = "closed"
)

What happened to a request in a window, one kind per event. Opened is read off the request's creation time; the rest are timeline events.

View Source
const (
	Open   = "open"
	Merged = "merged"
	Closed = "closed"
)

The three states a request can be in, whichever CLI spelled them.

View Source
const (
	OwnFields     = "number,title,state,isDraft,headRefName,baseRefName,url,author,createdAt,mergedAt,changedFiles,mergeCommit"
	ForeignFields = "number,title,state,url,author,mergedAt,mergedBy"
	BoardFields   = "number,title,state,isDraft,headRefName,baseRefName,headRefOid,url,author,assignees," +
		"reviewRequests,reviews,reviewDecision,mergeable,mergeStateStatus,statusCheckRollup," +
		"createdAt,updatedAt,mergedAt,mergedBy,closedAt,body,mergeCommit"
)

The gh field sets: a person's own requests, other people's, and what a board wants to know about every request.

View Source
const (
	Approved         = "approved"
	ChangesRequested = "changes_requested"
	ReviewRequired   = "review_required"
	Commented        = "commented"

	Clean     = "clean"
	Conflicts = "conflicts"
	Blocked   = "blocked"

	Green   = "green"
	Red     = "red"
	Pending = "pending"
)

The vocabularies the host's words are read into.

View Source
const ActivityQuery = `` /* 1365-byte string literal not displayed */

ActivityQuery is the GraphQL a GitHub feed reads: requests updated since the window's start with their timeline, and the quiet open ones counted. A timeline keeps its newest 100 events, which a request rarely passes.

View Source
const ForcePushesQuery = "query($owner: String!, $name: String!, $number: Int!) { repository(owner: $owner, name: $name) " +
	"{ pullRequest(number: $number) { timelineItems(last: 100, itemTypes: [HEAD_REF_FORCE_PUSHED_EVENT]) " +
	"{ nodes { ... on HeadRefForcePushedEvent { createdAt actor { login } beforeCommit { oid } afterCommit { oid } } } } } } }"

ForcePushesQuery is the GraphQL that lists a PR's force-pushes.

View Source
const HeadFields = "number,state,headRefName,headRefOid,baseRefName,url,author,createdAt,mergedAt,closedAt"

HeadFields are what the janitor reads of a branch's requests.

View Source
const PRLimit = 1000

PRLimit caps each gh search. Reaching it is an error rather than a report silently missing the rest.

Variables

View Source
var (
	// ErrNotFound is the host saying the issue or request does not exist.
	ErrNotFound = errors.New("not found")
	// ErrUnsupported is a host without the feature asked for, such as
	// GitHub sub-issues or GitLab work items.
	ErrUnsupported = errors.New("not supported by this host")
)

The kinds a host failure is classified into; callers test them with errors.Is and never read the CLI's words.

View Source
var ErrNoIssueParent = errors.New("GitLab nests no issue under an issue; list the subtasks in the parent's body")

ErrNoIssueParent is GitLab, which nests tasks, not issues, under an issue.

View Source
var ErrNoThread = errors.New("the url names no thread to reply in")

ErrNoThread is a url that names no thread to reply in: an issue comment, a review with no inline comments, a check run.

View Source
var ErrNotIssue = errors.New("a pull request, not an issue")

ErrNotIssue is a number that names a pull request where an issue was meant: gh numbers both from one counter and answers `issue view` for either.

Functions

func PullNumber added in v0.58.0

func PullNumber(url string) string

PullNumber is a request's url as its host writes the number, for a caller holding only the url: a GitLab merge request's path names it, so `!12`, else `#128`.

func SameLogin

func SameLogin(declared, login string) bool

SameLogin matches a declared identity against a host login, case blind. A bare `claude` also matches `claude[bot]`, never the reverse, or a user registering the bare name could post as the declared bot.

func Status

func Status(state string) string

Status normalises a request's state: gh spells them OPEN / MERGED / CLOSED, glab opened / merged / closed / locked.

Types

type Activity added in v0.39.0

type Activity struct {
	Requests    []Touched
	QuietCount  int
	QuietOldest time.Time // the oldest quiet request's creation time
}

Activity is what a repository did since a time: every request touched, and how many open ones nobody touched, with the oldest of them.

type CI

type CI struct {
	Red bool
	At  time.Time
}

CI is how the checks on a commit ended: Red when any failed, At the time of the last failure.

type Child added in v0.58.0

type Child struct {
	Number string
	Title  string
	URL    string
	State  string
	Body   string
	Labels []string
}

A Child is one issue linked under another.

type Comment added in v0.49.0

type Comment struct {
	Author string
	Body   string
	At     time.Time
}

A Comment is one plain comment on a request, oldest first.

type CommitStatus added in v0.49.0

type CommitStatus struct {
	Name        string
	State       string
	Description string
}

A CommitStatus is one named status on a commit; State is "success", "failure" or the host's own word for anything else.

type Error added in v0.58.0

type Error struct {
	Host   string // "gh" or "glab"
	Code   int
	Stderr string
	// contains filtered or unexported fields
}

An Error is a host CLI exiting non-zero. Its text is the CLI's own stderr, since that names the cause better than any paraphrase.

func (*Error) Error added in v0.58.0

func (e *Error) Error() string

func (*Error) Unwrap added in v0.58.0

func (e *Error) Unwrap() error

type Event added in v0.39.0

type Event struct {
	Kind    string
	At      time.Time
	Actor   string
	Message string // a commit's whole message, trailers included
	State   string // a review's: Approved, ChangesRequested or Commented
}

An Event is one thing that happened to a request.

type ForcePush

type ForcePush struct {
	At     time.Time
	Before string
	After  string
	// SamePatches is whether every commit kept its patch, nil when git
	// cannot tell; the reader that owns the checkout fills it.
	SamePatches *bool
}

A ForcePush is one force-push to a PR: the head it replaced and the one it set.

type Host

type Host struct {
	Name string // "gh" or "glab"
	Dir  string // the checkout the CLI reads the remote from
	// Repo names the repository when no checkout can: `owner/repo`, or
	// `host/owner/repo` off the CLI's default host; set, every command carries it.
	Repo string
}

A Host is one of the two forge CLIs, bound to the checkout it answers for, or to a repository named outright where no checkout exists.

func (Host) Activity added in v0.39.0

func (h Host) Activity(ctx context.Context, since time.Time) (Activity, error)

Activity reads what the repository did since since: one paged query on GitHub, on GitLab a list of the updated merge requests read one by one.

func (Host) AllIssues added in v0.58.0

func (h Host) AllIssues(ctx context.Context) ([]Issue, error)

AllIssues is every issue in any state, numbers and titles only. Neither CLI's issue list includes requests, so nothing here filters them.

func (Host) At

func (h Host) At(dir string) Host

At is the same host answering from another checkout of the repo.

func (Host) Branches added in v0.39.0

func (h Host) Branches(ctx context.Context) (map[string]bool, error)

Branches is every branch the host has, one paged listing: what the board asks of every merged request at once.

func (Host) Children added in v0.58.0

func (h Host) Children(ctx context.Context, number string) ([]Child, error)

Children reads an issue's linked children: GitHub sub-issues, or GitLab work-item children. A host without either answers ErrUnsupported.

func (Host) CommentIssue added in v0.58.0

func (h Host) CommentIssue(ctx context.Context, number, body string) (string, error)

CommentIssue posts body on an issue, never a request, and returns the comment's url when the CLI prints one.

func (Host) CommitCI

func (h Host) CommitCI(ctx context.Context, sha string) (*CI, error)

CommitCI is how the checks on a commit ended, nil when it has none. On GitHub that is its check runs and its commit statuses; on GitLab its last pipeline.

func (Host) CreateIssue added in v0.58.0

func (h Host) CreateIssue(ctx context.Context, title, body string, labels []string) (string, string, error)

CreateIssue returns the new issue's url and number, read from the url the CLI prints: a list query afterwards could find another create's issue.

func (Host) CreatePull added in v0.49.0

func (h Host) CreatePull(ctx context.Context, n NewPull) error

CreatePull opens a request from a branch already on the remote, so neither CLI stops to ask about pushing it.

func (Host) DefaultBranchName

func (h Host) DefaultBranchName(ctx context.Context) (string, error)

DefaultBranchName is the repo's default branch as the host has it.

func (Host) DeleteBranch added in v0.58.0

func (h Host) DeleteBranch(ctx context.Context, branch string) error

DeleteBranch deletes branch on the host through the API rather than `--delete-branch`, which also deletes the local branch, refused while a worktree holds it, so gh exits non-zero after the merge landed. Unlike the host's delete on merge this closes every request based on branch, so callers retarget them first.

func (Host) EarlierRequests added in v0.39.0

func (h Host) EarlierRequests(ctx context.Context, ids []string) (map[string][]PR, error)

EarlierRequests is every request that may name each id, to tell a task's first request from a follow-up: one GraphQL call for every id on GitHub, one list per id on GitLab. The searches only narrow; the caller matches.

func (Host) EditIssue added in v0.58.0

func (h Host) EditIssue(ctx context.Context, number string, e IssueEdit) error

EditIssue writes e; an empty edit writes nothing.

func (Host) EditPull added in v0.49.0

func (h Host) EditPull(ctx context.Context, selector, title, body string) error

EditPull rewrites a request's title, its body, or both; "" leaves one as it is. selector is what the CLI takes: a number or a branch.

func (Host) HeadRef added in v0.58.0

func (h Host) HeadRef(number string) string

HeadRef is the ref a request's head lives under on origin, fetchable after its branch is deleted.

func (Host) IsLogin added in v0.58.0

func (h Host) IsLogin(declared, login string) bool

IsLogin matches a declared reviewer against a login. GitLab names a bot by username alone, with no suffix anyone could forge, so a declared `[bot]` is dropped there; on GitHub SameLogin's rule stands.

func (Host) Issue added in v0.58.0

func (h Host) Issue(ctx context.Context, number string) (Issue, error)

Issue reads an issue, refusing a number that names a request.

func (Host) IssueWithComments added in v0.58.0

func (h Host) IssueWithComments(ctx context.Context, number string) (Issue, error)

IssueWithComments is Issue with the issue's comments read too.

func (Host) Issues added in v0.58.0

func (h Host) Issues(ctx context.Context, query string, limit int) ([]Issue, error)

Issues lists the open issues, those matching query when one is given.

func (Host) IssuesURL added in v0.58.0

func (h Host) IssuesURL(ctx context.Context) (string, error)

IssuesURL is the repository's issue list page.

func (Host) Item added in v0.58.0

func (h Host) Item(ctx context.Context, number string) (Issue, error)

Item reads number whether it names an issue or a request; Pull tells which.

func (Host) LatestStatus added in v0.49.0

func (h Host) LatestStatus(ctx context.Context, sha, name string) (*CommitStatus, error)

LatestStatus is the newest status named name on sha, nil when it has none.

func (Host) LinkParent added in v0.58.0

func (h Host) LinkParent(ctx context.Context, parent, child string) error

LinkParent puts child under parent, moving it from a parent it already has: GitHub gives an issue one parent, and links by the child's database id, not its number.

func (Host) Login

func (h Host) Login(ctx context.Context) (string, error)

Login is who the CLI is signed in as: gh names it login, glab username.

func (Host) MRForcePushes

func (h Host) MRForcePushes(ctx context.Context, iid int, since time.Time) ([]ForcePush, error)

MRForcePushes reads GitLab's MR versions, one per push, since the time: a version whose previous head is not its ancestor replaced commits. GitLab records no pusher, so on the user's own MR each counts as theirs.

func (Host) MRReviews

func (h Host) MRReviews(ctx context.Context, iid int) ([]Review, error)

MRReviews is the notes that count as reviewing: any plain comment, and the system note an approval leaves.

func (Host) MergeMethods added in v0.58.0

func (h Host) MergeMethods(ctx context.Context) ([]string, error)

MergeMethods is what the repository allows, as MergePR methods. GitLab fixes one strategy per project: "--squash" when its squash option is on, else "" for its plain merge.

func (Host) MergePR added in v0.58.0

func (h Host) MergePR(ctx context.Context, p PR, branch, method, body string) (PR, error)

MergePR merges the request on branch and reads it back, since the merge commit exists only after. method is "--squash", "--merge", "--rebase", or "" for GitLab's plain merge, where the project fixes the strategy.

Never --admin: a refusing host has a reason. glab's auto-merge is off so a running pipeline refuses rather than queues; its squash message replaces the whole commit message, so the title goes on top. gh's squash gets the title as its subject, else GitHub uses a lone commit's subject.

func (Host) MethodFor added in v0.58.0

func (h Host) MethodFor(declared string) string

MethodFor is a declared merge method (squash, merge, rebase) as MergePR takes it: GitLab's "merge" is its plain merge, which takes no flag.

func (Host) OpenPRs added in v0.58.0

func (h Host) OpenPRs(ctx context.Context, limit int) ([]PR, error)

OpenPRs is the first page of open requests, newest first.

func (Host) OpenReviews added in v0.58.0

func (h Host) OpenReviews(ctx context.Context, number string) (*ReviewPR, error)

OpenReviews reads the request number names, or the current branch's.

func (Host) Owner added in v0.58.0

func (h Host) Owner(ctx context.Context, p PR) (Owner, error)

Owner reads the signed-in login and compares it with p's author; a request with no author is unknown without asking the host.

func (Host) PR added in v0.58.0

func (h Host) PR(ctx context.Context, selector string) (PR, error)

PR reads one request by branch or number. A missing one is ErrNotFound, its text the CLI's own words.

func (Host) PRBody added in v0.58.0

func (h Host) PRBody(ctx context.Context, branch string) (string, error)

PRBody is the request's description alone, read fresh right before a write that must not act on a stale one.

func (Host) PRForcePushes

func (h Host) PRForcePushes(ctx context.Context, number int, login string) ([]ForcePush, error)

PRForcePushes is the force-pushes the user made to a PR, the last 100: GitHub records each with the head before and after.

func (Host) PostComment added in v0.49.0

func (h Host) PostComment(ctx context.Context, number int, webURL, thread, body string) (string, error)

PostComment posts body in thread, or as a top-level comment when thread is "", and returns the new comment's url.

func (Host) PullComments added in v0.49.0

func (h Host) PullComments(ctx context.Context, number int) ([]Comment, error)

PullComments is the request's conversation; GitLab's system notes (pushes, approvals, label changes) are events, not comments, and are left out.

func (Host) PullCommits

func (h Host) PullCommits(ctx context.Context, number int) ([]PRCommit, error)

PullCommits is the commits a request lists, one call per request: asked for inside the list query, gh's GraphQL refuses a node count past its limit.

func (Host) PullDiff added in v0.49.0

func (h Host) PullDiff(ctx context.Context, number int) (string, error)

PullDiff is the request's diff as the host has it: what was pushed, not what a checkout holds.

func (Host) Pulls

func (h Host) Pulls(ctx context.Context, login string, since time.Time) ([]PR, error)

Pulls is every request a person's standup needs: their own, with their commits and force-pushes, and others' they reviewed or merged since since.

func (Host) PullsByHead added in v0.45.0

func (h Host) PullsByHead(ctx context.Context, branch string) ([]PR, error)

PullsByHead is every request whose head is branch, in any state, newest first. A branch can carry several: one closed, then another opened.

func (Host) PullsSince

func (h Host) PullsSince(ctx context.Context, since time.Time) ([]PR, error)

PullsSince is what a board reads: every open request, and every one merged since since, each with the board's fields and no commits.

func (Host) PullsURL added in v0.58.0

func (h Host) PullsURL(ctx context.Context) (string, error)

PullsURL is the repository's request list page.

func (Host) Ref added in v0.58.0

func (h Host) Ref(n int) string

Ref is request n as the host writes it: #12, or !12 on GitLab.

func (Host) RepoURL added in v0.58.0

func (h Host) RepoURL(ctx context.Context) (string, error)

RepoURL is the repository's web page, read from the host rather than the remote, so a fork or a self-hosted GitLab gets its own.

func (Host) Retarget added in v0.58.0

func (h Host) Retarget(ctx context.Context, number int, base string) error

Retarget moves a request to base, by number: a stacked request's head is another task's branch.

func (Host) SearchPRs

func (h Host) SearchPRs(ctx context.Context, query, fields string) ([]PR, error)

SearchPRs is one `gh pr list --search` with the fields named.

func (Host) SetIssueOpen added in v0.58.0

func (h Host) SetIssueOpen(ctx context.Context, number string, open bool) error

SetIssueOpen reopens the issue, or closes it; both CLIs spell it alike.

func (Host) SetStatus added in v0.49.0

func (h Host) SetStatus(ctx context.Context, sha string, s CommitStatus) error

SetStatus sets a named status on sha; state is "success" or "failure", which GitLab spells "failed".

func (Host) SharedNumbers added in v0.58.0

func (h Host) SharedNumbers() bool

SharedNumbers reports whether issues and requests share one counter, so a bare #n may name either; GitLab numbers them apart.

func (Host) ShowPR added in v0.58.0

func (h Host) ShowPR(ctx context.Context, number string, web bool) error

ShowPR prints the request to the terminal through the CLI, or opens it in the browser.

func (Host) Sigil added in v0.58.0

func (h Host) Sigil() string

Sigil is how the host writes a request's number: #n, or GitLab's !n.

func (Host) StackedPRs added in v0.58.0

func (h Host) StackedPRs(ctx context.Context, branch string) ([]PR, error)

StackedPRs is every open request based on branch, paged past both CLIs' default 30: one left out would be closed by the branch's delete.

func (Host) Thread added in v0.49.0

func (h Host) Thread(ctx context.Context, number int, threadURL string) (string, error)

Thread is the thread a url names on request number: GitHub's top-level review comment, which replies attach to (a reply to a reply is refused), or GitLab's discussion. A review url is the url review pick records for an inline review, and names the thread of its first comment.

func (Host) ThreadComments added in v0.49.0

func (h Host) ThreadComments(ctx context.Context, number int, webURL, thread string) ([]Posted, error)

ThreadComments is every comment in thread, or the request's top-level conversation when thread is "". webURL is the request's own url, which a GitLab note's url hangs off.

func (Host) Token added in v0.58.0

func (h Host) Token(ctx context.Context) (string, error)

Token is gh's auth token, for fetching GitHub attachments the CLI cannot; "" on glab, whose attachments need none.

func (h Host) Unlink(ctx context.Context, child string) error

Unlink takes child out from under the parent it has; an issue with none is left alone, so a rerun is safe.

type Issue added in v0.58.0

type Issue struct {
	Number    string
	Title     string
	State     string // as the CLI spells it: OPEN, opened, closed...
	URL       string
	Body      string
	Labels    []string
	Assignees []string
	CreatedAt time.Time
	Comments  []IssueComment // read only by IssueWithComments
	Pull      bool           // the number names a pull or merge request
}

An Issue is a task on the host's own tracker, as the host reported it.

type IssueComment added in v0.58.0

type IssueComment struct {
	Author string
	Body   string
}

An IssueComment is one comment on an issue, by its author's login.

type IssueEdit added in v0.58.0

type IssueEdit struct {
	Title        string
	AddLabels    []string
	RemoveLabels []string
	// Assignee replaces the issue's assignees, as glab's flag does; on gh,
	// which only adds one, the others in Current come off by name.
	Assignee string
	Current  []string
}

An IssueEdit is one edit of an issue's title, labels and assignee; the zero value of a field leaves it alone.

type NewPull added in v0.49.0

type NewPull struct {
	Head, Base, Title, Body string
	Labels, Assignees       []string
	Draft                   bool
}

A NewPull is a request to open: the branch, the branch it targets, and what the CLIs set on it at creation.

type Note added in v0.58.0

type Note struct {
	ID        string
	URL       string
	Author    string // "" for GitLab discussions, which the caller names
	Body      string // an inline review's comments folded in
	Stored    string // the host's own text, which an edit rewrites
	SHA       string
	CreatedAt time.Time
	UpdatedAt time.Time

	Inline     bool     // an inline review or discussion, not an issue comment
	CommentID  string   // inline: the comment a reaction or marker lands on
	Threads    []string // inline: the threads it opened
	ThreadsErr error    // inline: why Threads could not be read
	Pending    bool     // inline: not yet submitted
	Concluded  bool     // check: finished; GitLab inline: every thread resolved
}

A Note is one reviewer's artifact as the host keeps it: an issue comment, an inline review (GitLab: the reviewer's open discussions, folded), or a check run (GitLab: a pipeline job).

type Owner added in v0.58.0

type Owner int

An Owner says whether a request is the signed-in user's.

const (
	// OwnerUnknown is a request with no author, or a login the host would not tell
	OwnerUnknown Owner = iota
	OwnerMine
	OwnerOther
)

func OwnerOf added in v0.58.0

func OwnerOf(author, login string) Owner

OwnerOf compares a request's author with the signed-in login. Either one empty is unknown, never mine or someone else's, so each caller decides what an unknown owner allows.

type PR

type PR struct {
	Number    int
	Title     string
	URL       string
	Status    string // Open, Merged or Closed
	Draft     bool
	Empty     bool // no changes yet: no changed files on GitHub, no commits on GitLab
	Head      string
	HeadSHA   string
	Base      string
	Author    string
	Assignees []string
	Reviewers []string // reviewers requested and not yet heard from
	CreatedAt time.Time
	UpdatedAt time.Time
	MergedAt  time.Time // zero unless merged
	ClosedAt  time.Time // zero unless closed
	MergedBy  string
	Body      string
	Decision  string     // Approved, ChangesRequested, ReviewRequired or ""
	Mergeable string     // Clean, Conflicts, Blocked or ""
	Checks    string     // Green, Red, Pending or "" with none
	Commits   []PRCommit // the commits the host lists for it, where asked for
	MergeSHA  []string   // the merge and squash commits it landed as
	Landed    string     // the commit it landed as: gh's merge commit, else glab's squash, else its merge
	Fork      bool       // its branch lives in another repository, which origin does not have
	Reviews   []Review   // where asked for

	ForcePushes []ForcePush // the requester's own, where asked for
}

A PR is a pull or merge request as the host reported it.

type PRCommit

type PRCommit struct {
	SHA     string
	Subject string
	Message string // the whole message, trailers included
	Email   string // the author's email, as the commit records it
	At      time.Time
	Parents int // more than one is a merge
}

A PRCommit is one commit a PR lists. A rebase merge lands it on the default branch under a new sha, keeping its author date and subject.

type Posted added in v0.49.0

type Posted struct {
	Author string
	Body   string
	URL    string
}

A Posted comment is one already on a request, as far as a duplicate check needs it.

type Review

type Review struct {
	Author string
	State  string // Approved, ChangesRequested, Commented or ""
	At     time.Time
}

A Review is one review event on a PR: a submitted review, an approval or a comment, by anyone.

type ReviewCommit added in v0.58.0

type ReviewCommit struct {
	SHA string
	At  time.Time
}

A ReviewCommit is one of the request's commits, by its commit date.

type ReviewPR added in v0.58.0

type ReviewPR struct {
	Number  string
	HeadSHA string
	URL     string
	Commits []ReviewCommit // oldest first
	// contains filtered or unexported fields
}

A ReviewPR is a request opened to read and answer the reviews left on it, with the commits a comment's sha is derived from (an issue comment stores none).

func (*ReviewPR) Checks added in v0.58.0

func (p *ReviewPR) Checks(ctx context.Context, name string) ([]Note, error)

Checks is every check run on the head named name, or on GitLab every job of the head pipeline; a finished job's log is its body.

func (*ReviewPR) Comment added in v0.58.0

func (p *ReviewPR) Comment(ctx context.Context, text string) (string, time.Time, error)

Comment posts text on the request and returns the comment's url and the host's time for it, zero when the host gives none.

func (*ReviewPR) Comments added in v0.58.0

func (p *ReviewPR) Comments(ctx context.Context, want func(login string) bool) ([]Note, error)

Comments is every issue comment, or merge request note, by an author want accepts. Every page is read: the oldest come first, so a review past the first page is the newest one.

func (*ReviewPR) EditBody added in v0.58.0

func (p *ReviewPR) EditBody(ctx context.Context, n Note, body string) error

EditBody replaces the text of n, the note's own on GitLab.

func (*ReviewPR) FreshReactions added in v0.58.0

func (p *ReviewPR) FreshReactions(ctx context.Context, n Note) (map[string]bool, error)

FreshReactions is the set of reactions the viewer left on n since its last edit; nil for an inline review with no comment to react to.

func (*ReviewPR) InlineReviews added in v0.58.0

func (p *ReviewPR) InlineReviews(ctx context.Context, want func(login string) bool) ([]Note, error)

InlineReviews is every submitted or pending review by an author want accepts, its line comments folded into the body. GitLab has no review object, so its reviewer's resolvable discussions fold into one.

func (*ReviewPR) React added in v0.58.0

func (p *ReviewPR) React(ctx context.Context, n Note, emoji string) error

React leaves emoji on n.

func (*ReviewPR) RequestReview added in v0.58.0

func (p *ReviewPR) RequestReview(ctx context.Context, login string) error

RequestReview asks login for a review of the request.

func (*ReviewPR) ResolveThreads added in v0.58.0

func (p *ReviewPR) ResolveThreads(ctx context.Context, threads []string) error

ResolveThreads resolves each of the threads, stopping at the first failure.

func (*ReviewPR) ShaBefore added in v0.58.0

func (p *ReviewPR) ShaBefore(t time.Time) string

ShaBefore is the head a reviewer saw when it posted at t; the head sha when no commit precedes it.

func (*ReviewPR) ThreadsResolved added in v0.58.0

func (p *ReviewPR) ThreadsResolved(ctx context.Context, n Note) (bool, error)

ThreadsResolved reports whether every thread n opened is resolved. gh threads are read again, since their ids were gathered without their state; glab discussions carry the flag, folded into Concluded.

func (*ReviewPR) Viewer added in v0.58.0

func (p *ReviewPR) Viewer(ctx context.Context) (string, error)

Viewer is who the CLI acts as: the only login whose reaction counts.

type Touched added in v0.39.0

type Touched struct {
	PR

	Events []Event
}

A Touched is a request updated in the window, with what happened to it there.

Jump to

Keyboard shortcuts

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