nudge

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 13 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 nudge is the GitHub plugin's nudge: whom a nudge asks on a pull request, when it refuses, and the nudge drafts its github-nudge rule proposes on stalled pull requests.

Index

Constants

View Source
const (
	EffectNudged     = "pr.nudged"
	EffectTaskNudged = "task.nudged"
)

The effects a proposed nudge draft declares, as the manifests name them.

View Source
const Maintainers = "the maintainers (no reviewer requested)"

Maintainers is whom a nudge asks on the user's own pull request with no reviewer: the skill mentions nobody, or the one code owner.

View Source
const Purpose = "nudge"

Purpose is the purpose of the plugin's nudge drafts.

View Source
const RenudgeAfter = 24 * time.Hour

RenudgeAfter is how long a wait that a nudge did not move stays nudged.

View Source
const Rule = "github-nudge"

Rule is the Origin.Rule of the nudge drafts the plugin proposes.

View Source
const TextsFile = "prompts/github-nudge.tmpl"

TextsFile is the nudge's texts in the plugin's profile layer.

Variables

This section is empty.

Functions

func Proposals

func Proposals(ctx context.Context, rows []row.Row, rd Reader, x Texts, ignore []string, now time.Time) (src.Proposed, error)

Proposals are the nudge drafts of rows at now, reading the host's overrides and turns of the stalled ones only, and the withdrawal of the nudge on each open one no longer stalled. A hold, a mute or a running turn only keeps a stalled one's nudge from being proposed now.

func Propose

func Propose(r row.Row, h Host, x Texts, ignore []string, now time.Time) (src.Draft, bool, error)

Propose is the nudge draft of r, whom it asks, when r is stalled, the host holds no round, mute or loop turn on it, and the nudge would not be refused now; its text is x's.

func Refusal

func Refusal(ref pr.Ref, who []string, why string, since time.Time, evs []pr.Event, unstarted map[string]bool, now time.Time) string

Refusal is the text a nudge is refused with now, "" when it would go; unstarted are the turns that ended before their agent started them, whose nudged events do not count.

func Running

func Running(b src.Book) bool

Running says whether b's turn that drives the row sets its situation: the loop works on the pull request, asks or stopped, so the pull request waits on the loop.

func Stalled

func Stalled(r row.Row) bool

Stalled says whether r is one the github-nudge rule considers: its stalled signal is on, and it is not one its card alone shows (a draft, approved by the viewer, done).

func Targets

func Targets(s Situation, author, viewer string, ignore []string) ([]string, string)

Targets is who a nudge mentions, or why it mentions nobody: s's kind, waits-on and reason, author its pull request's author.

func Unstarted

func Unstarted(b src.Book) map[string]bool

Unstarted are the ids of b's turns that ended before their agent started them, which posted nothing.

func Who

func Who(body string) string

Who is whom body asks, as the nudged event records it.

Types

type Host

type Host struct {
	Overrides map[string]string
	Book      src.Book
	Asleep    bool
}

Host is what a proposal reads of the host for one pull request: its overrides, its turns, and whether its task sleeps, deferred under a wake such as the user's mute.

type Reader

type Reader interface {
	Books(ctx context.Context, units []sdk.Unit) ([]src.Book, error)
	RoundState(ctx context.Context, u sdk.Unit) (src.RoundState, error)
	Tasks(ctx context.Context, units []sdk.Unit) ([]src.Task, error)
}

Reader is what Proposals reads of the host.

type Situation

type Situation struct {
	Kind    string
	WaitsOn string
	Since   time.Time
	Reason  string
}

Situation is what a pull request waits on, as a nudge reads it.

func Of

func Of(r row.Row) Situation

Of is r's source situation.

type Texts

type Texts struct {
	// contains filtered or unexported fields
}

Texts are the nudge's texts, as the profile's templates word them: the draft of the github-nudge rule and the situation line of the prepare.

func ParseTexts

func ParseTexts(raw string) (Texts, error)

ParseTexts reads raw, the profile's TextsFile.

func (Texts) Text

func (x Texts) Text(who []string, s Situation) (string, error)

Text asks who for the next step; a person is a mention, a team is written as GitHub mentions it, since its key would post as plain text.

func (Texts) Waiting

func (x Texts) Waiting(who []string, s Situation) (string, error)

Waiting is the line the nudge intent's prompt reads of whom the pull request waits on and since when, worded by the situation's kind: a reason can carry CI job names.

Jump to

Keyboard shortcuts

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