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
- func Proposals(ctx context.Context, rows []row.Row, rd Reader, x Texts, ignore []string, ...) ([]src.Draft, error)
- func Propose(r row.Row, h Host, x Texts, ignore []string, now time.Time) (src.Draft, bool, error)
- func Refusal(ref pr.Ref, who []string, why string, since time.Time, evs []pr.Event, ...) string
- func Running(b src.Book) bool
- func Stalled(r row.Row) bool
- func Targets(s Situation, author, viewer string, ignore []string) ([]string, string)
- func Unstarted(b src.Book) map[string]bool
- func Who(body string) string
- type Host
- type Reader
- type Situation
- type Texts
Constants ¶
const ( EffectNudged = "pr.nudged" EffectTaskNudged = "task.nudged" )
The effects a proposed nudge draft declares, as the manifests name them.
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.
const Purpose = "nudge"
Purpose is the purpose of the plugin's nudge drafts.
const RenudgeAfter = 24 * time.Hour
RenudgeAfter is how long a wait that a nudge did not move stays nudged.
const Rule = "github-nudge"
Rule is the Origin.Rule of the nudge drafts the plugin proposes.
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.Draft, error)
Proposals are the nudge drafts of rows at now, reading the host's overrides and turns of the stalled ones only.
func Propose ¶
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 ¶
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 ¶
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 ¶
Targets is who a nudge mentions, or why it mentions nobody: s's kind, waits-on and reason, author its pull request's author.
Types ¶
type Host ¶
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 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 ¶
ParseTexts reads raw, the profile's TextsFile.