Documentation
¶
Overview ¶
Package change holds the rules that decide what a change to a pull request calls for: a follow-up, a triage round, a board move.
Index ¶
- func Approved(f pr.Facts) bool
- func ChecksPass(f pr.Facts) bool
- func FailingChecks(f pr.Facts, handledHead string, ignore []string) []string
- func HeadMoved(commits []pr.Commit, headOid, reviewedOid string) bool
- func LastReview(reviews []pr.Review, viewer string) (pr.Review, bool)
- func ReviewsToAddress(in AddressInput) (reviewers []string, fingerprint string)
- func Untrusted(f pr.Facts, owners, authors []string) string
- type AddressInput
- type RecordedReview
- type ReviewerAction
- type ReviewerDecision
- type ReviewerInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Approved ¶
Approved also covers repositories without required reviews, where reviewDecision is null.
func ChecksPass ¶
ChecksPass treats a repository without checks as passing.
func FailingChecks ¶
FailingChecks returns the checks that failed on the head of my pull request once every check has finished, unless a triage round already covered that head. Ignored checks neither fire a round nor hold it back.
func HeadMoved ¶
HeadMoved reports whether the head has commits after the reviewed one beyond merges from the base branch. When the reviewed commit is no longer in the listed history (force push, or more than the listed commits since), every listed commit counts.
func LastReview ¶
LastReview is my newest submitted review. PENDING has no submittedAt. DISMISSED counts: repositories that dismiss stale reviews on push turn my last real review into DISMISSED exactly when the PR changed.
func ReviewsToAddress ¶
func ReviewsToAddress(in AddressInput) (reviewers []string, fingerprint string)
ReviewsToAddress returns the reviewers whose reviews or open threads a triage round on my pull request should cover, and the fingerprint to record once it starts. Without a previous round, reviews count only on the current head (older ones predate a push, which is how I usually answer by hand), while an open thread whose last word is someone else's always counts.
Types ¶
type AddressInput ¶
type RecordedReview ¶
RecordedReview is the head a turn's record covered when it published a verdict, and when it was recorded. GitHub moves a review's commit to later pushes, so this head is the baseline for the review it recorded.
type ReviewerAction ¶
type ReviewerAction int
const ( ReviewerNothing ReviewerAction = iota ReviewerComplete ReviewerFollowup )
type ReviewerDecision ¶
type ReviewerDecision struct {
Action ReviewerAction
Reason string
// Fingerprint identifies what a follow-up covers: the submittedAt of my
// last review and the head, so a round that published nothing still lets
// the next push start another, marked when a re-request started it. On
// ReviewerNothing it is set only to upgrade a fingerprint stored without
// the head.
Fingerprint string
LastReviewAt time.Time
}
func Reviewer ¶
func Reviewer(in ReviewerInput) ReviewerDecision
type ReviewerInput ¶
type ReviewerInput struct {
PR pr.Facts
Viewer string
WorkspaceStatus string
// CompletedStatus is the board's completed column; empty when it has none.
CompletedStatus string
// TrustedOwners are the repository owners automated rounds may run for.
TrustedOwners []string
// TrustedAuthors are logins that pass the author association check.
TrustedAuthors []string
LastFingerprint string
// Recorded is the loop's record of my last verdict; zero when none.
Recorded RecordedReview
}