row

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 10 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 row derives what the plugin reports of a pull request from the pull request and its events alone: its situation, the source part of its row's payload, its views and facets, its card, its items, its link signals and its workflow facts. The host lays its own state over them.

Index

Constants

View Source
const (
	ToneNeutral = "neutral"
	ToneGood    = "good"
	ToneWarn    = "warn"
	ToneBad     = "bad"
)

The tones of a card's signals.

View Source
const (
	SignalSituation = "situation"
	SignalChecks    = "checks"
	SignalReview    = "review"
	SignalMerge     = "merge"

	ChecksFailing      = "failing"
	ChecksFailingNamed = "failing_named"
	ChecksPending      = "pending"
	ChecksPassing      = "passing"
	ReviewApproved     = "approved"
	MergeConflicts     = "conflicts"

	// NoteStalled is the situation's note once it is stalled, counting from
	// when the situation began.
	NoteStalled = "stalled"
)

The keys of a card's signals and the codes of their values and notes, which the plugin's ui.toml [signals] words. The situation signal's value is the situation's kind.

View Source
const (
	FacetWhere  = "where"
	FacetAuthor = "author"
	FacetStatus = "status"
	FacetCI     = "ci"
	FacetScope  = "scope"
	FacetOpened = "opened"
)

The facets of a row whose values the plugin reports; the host derives the facets that read its own state or the row's situation after its overlays.

View Source
const (
	SignalStalled   = "stalled"
	SignalInLoop    = "in_loop"
	SignalReady     = "ready"
	SignalWorkspace = "workspace"
)

The link signals plugin.toml declares.

View Source
const ItemFollow = "gh:follow"

ItemFollow is the item of a followed pull request that asks nothing else: it waits on whoever the pull request waits on, or on the loop, so the pull request keeps its one task.

View Source
const ViewMine = "mine"

ViewMine is the plugin's view of the viewer's own or adopted open pull requests.

Variables

This section is empty.

Functions

func FactsOf added in v0.4.0

func FactsOf(in Input) []src.Fact

FactsOf are the workflow facts of in's pull request, which its situation does not change: the facts the profile's predicates read before Derive.

func MineAuthor

func MineAuthor(p Payload) bool

MineAuthor says the viewer authored the pull request of p.

func NeedsMe

func NeedsMe(kind situation.Kind, waitingOn string, p Payload) bool

NeedsMe is the needs-me predicate of a situation: it waits on the user, asks, holds or is the user's own to fix, in scope or in the loop.

func People

func People(waitingOn string, p Payload) []src.Person

People reads a situation's waiting-on: "me", "author", "nobody" or logins.

func Person

func Person(login string) src.Person

Person is a GitHub login, or the group of a "team:<org>/<slug>" request.

func Stamp

func Stamp(t time.Time) string

Stamp is t as a time facet holds it.

Types

type Checks

type Checks struct {
	State   string   `json:"state"`
	Failing []string `json:"failing,omitempty"`
}

type Facts

type Facts struct {
	CreatedAt    time.Time `json:"created_at,omitzero"`
	ChangedFiles int       `json:"changed_files"`
	Checks       Checks    `json:"checks"`
}

Facts are the pull request's facts a row shows.

type Input

type Input struct {
	PR       pr.PR
	Events   []pr.Event
	Override pr.Override
	// Detail is the pull request's full read; nil before one.
	Detail *store.Detail
	Viewer string
	Teams  []string
	// Ignore are who a row never waits on: automated reviewers and the
	// reviewers an address round skips.
	Ignore  []string
	Stalled situation.Thresholds
	// AddressedAt is when the pull request's driving turn, an address turn,
	// reached its state; zero without one.
	AddressedAt time.Time
	// AskedAt is when the newest turn of an intent on the pull request asked
	// the user something no answer reached yet; zero without one.
	AskedAt time.Time
	// ReviewerOptional says the profile's reviewer_required does not hold for
	// the pull request.
	ReviewerOptional bool
	// MaxDetailAge is the oldest detail the plugin calls fresh.
	MaxDetailAge time.Duration
	// Loop is the loop's name, as items it asks of the user name it.
	Loop string
	Now  time.Time
	// Location is the calendar pr.silent_days counts midnights in; nil counts UTC's.
	Location *time.Location
}

Input is what one pull request's report derives from.

type LastHuman

type LastHuman struct {
	Who  string    `json:"who"`
	What string    `json:"what"` // the event kind: opened, push, review, comment
	At   time.Time `json:"at"`
	Link string    `json:"link"`
}

LastHuman is the newest human event on the pull request not by the viewer.

type Override

type Override struct {
	Adopted bool `json:"adopted,omitempty"`
	Tracked bool `json:"tracked,omitempty"`
}

Override is what the user set on the pull request that the plugin keeps.

type Payload

type Payload struct {
	Author    string     `json:"author"`
	Repo      string     `json:"repo"`
	Head      string     `json:"head"`
	Approved  bool       `json:"approved"`
	Reasons   []string   `json:"reasons"`
	Workspace Workspace  `json:"workspace"`
	Override  Override   `json:"override,omitzero"`
	Facts     *Facts     `json:"facts,omitempty"`
	Viewer    string     `json:"viewer"`
	LastHuman *LastHuman `json:"last_human,omitempty"`
}

Payload is the source part of a row's payload, in the keys the clients read; the host adds its own: the mute, the brief, the intake and the turns.

type Row

type Row struct {
	PR        pr.PR
	Situation situation.Result
	Payload   Payload
	Views     []string
	Facets    map[string][]string
	// contains filtered or unexported fields
}

Row is a pull request's source row: its situation and the source part of its payload, views and facets.

func Derive

func Derive(in Input) Row

Derive is in's source row at in.Now.

func (Row) Card

func (r Row) Card() *src.Card

Card is the pull request's card from its source row.

func (Row) Due

func (r Row) Due() time.Time

Due is the first instant after the input's now at which the report changes with time alone: the situation stalls, a held round's day ends, or a day of silence passes; zero for none.

func (Row) Events

func (r Row) Events() []pr.Event

Events are the host's events of the pull request the row derives from.

func (Row) Facts

func (r Row) Facts() []src.Fact

Facts are the row's workflow facts that read the pull request alone; the host adds those that read its own state.

func (Row) InScope

func (r Row) InScope() bool

InScope says the row has reasons, a review workspace, or is adopted or tracked.

func (Row) Items

func (r Row) Items() []src.Item

Items are the pull request's items from its source row, every one keyed on the pull request so they are the asks of its one task: what waits on the viewer when the row needs them or is the viewer's own to merge, staff or answer, what waits on others in scope, and otherwise, while the pull request is open and followed, ItemFollow. Someone else's pull request the viewer approved last, that does not need them and that they neither track nor adopted, asks nothing: merging it is its author's. A held or blocked round asks through its gate, never an item.

func (Row) Kind

func (r Row) Kind() situation.Kind

Kind is the row's situation kind.

func (r Row) Link() string

Link is the pull request's page.

func (Row) Mine

func (r Row) Mine() bool

Mine says the viewer authored the pull request.

func (Row) Report

func (r Row) Report() src.Snapshot

Report is the row's snapshot but its unit, rev, time and data.

func (Row) Signals

func (r Row) Signals() []src.Signal

Signals are the row's link signals: stalled, an open pull request in scope whose situation lasted past its threshold; in_loop, an open one a review workspace holds; ready, one whose work is approved; workspace, one a workspace of which remains, open or not.

func (Row) Stalled

func (r Row) Stalled() bool

Stalled says whether the row's situation is stalled at the input's now.

type Workspace

type Workspace struct {
	ID          string   `json:"id"`
	DisplayName string   `json:"display_name"`
	Status      string   `json:"status"`
	IsReview    bool     `json:"is_review"`
	AgentStates []string `json:"agent_states"`
	Comment     string   `json:"comment"`
	IsMain      bool     `json:"is_main"`
}

Workspace is the workspace a row shows.

func WorkspaceOf

func WorkspaceOf(w pr.Workspace) Workspace

WorkspaceOf is w as a row shows it.

Jump to

Keyboard shortcuts

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