Documentation
¶
Overview ¶
Package pr is the GitHub plugin's pull request: its reference and the row the plugin's store keeps of it.
Index ¶
Constants ¶
const ( KindOpened = "opened" KindPush = "push" // Key = commit oid KindReviewRequest = "review_requested" KindReviewRequestRemoved = "review_request_removed" KindReview = "review" // Key = review id, Data = STATE:headOid KindComment = "comment" // Key = comment id KindCheck = "check" // Key = headOid:STATE, At = first sighting KindReady = "ready" KindDraft = "draft" // back to draft; Actor = who converted it KindMerged = "merged" // Actor = the merger, Data = the merge commit oid KindClosed = "closed" KindRoundSent = "round_sent" KindRoundHeld = "round_held" KindRoundBlocked = "round_blocked" KindRoundUnblocked = "round_unblocked" // Data = what cleared it KindWouldAddress = "would_address" KindNudged = "nudged" // Data = who was asked KindTracked = "tracked" KindUntracked = "untracked" KindStatus = "status" // Data = board column KindFollowed = "followed" // Key = the time, Data = the reasons, ","-joined KindUnfollowed = "unfollowed" // Key = the time, Data = the reasons it was followed for KindReviewEnded = "review_ended" )
The kinds of the events the plugin records; plugin.toml declares the timeline's.
const ( ReviewApproved = "APPROVED" ReviewChangesRequested = "CHANGES_REQUESTED" ReviewCommented = "COMMENTED" ReviewDismissed = "DISMISSED" )
The states of a review.
const ( StateOpen = "OPEN" StateMerged = "MERGED" StateClosed = "CLOSED" )
The states of a pull request.
const Provider = "github"
Provider is the provider id of the plugin's units.
const ReasonTracked = "tracked"
ReasonTracked is the scope reason of a pull request the user tracks.
const ReviewTurnsFollowed = 30 * 24 * time.Hour
ReviewTurnsFollowed bounds how long after its newest review round a pull request stays followed for its follow-ups.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct {
PR Ref
Kind string
Key string // natural key; "" for singletons
Actor string
At time.Time
Data string
}
Event is an event on a pull request, which the host keeps.
type Facts ¶
type Facts struct {
Ref
State string
IsDraft bool
Title string
HeadRefName string
BaseRefName string
HeadRefOid string
IsCrossRepository bool
// Visibility is the repository's visibility, lower-case: public,
// private or internal; empty when not read.
Visibility string
Author string
AuthorAssociation string
ReviewDecision string
// Mergeable is MERGEABLE, CONFLICTING or UNKNOWN (GitHub computes it
// lazily); empty when not read.
Mergeable string
// ChecksState is the status check rollup of the head commit; empty when
// the repository has no checks.
ChecksState string
// NewestChangesRequestOid is the commit the newest CHANGES_REQUESTED
// review was left on.
NewestChangesRequestOid string
Reviews []Review
LatestReviews []Review
Comments []Comment
ReviewRequests []string
// ViewerRequested says the viewer's review is requested by name.
ViewerRequested bool
Commits []Commit
// OpenThreads are the unresolved review threads; ThreadsTotal counts
// every thread, read or not.
OpenThreads []Thread
ThreadsTotal int
Checks []Check
Labels []string
}
Facts are a pull request as the decide rules read it.
type FailingCheck ¶
type Override ¶
type Override struct {
Ref Ref
Adopted bool // taken over into the loop
Tracked bool // added by hand; the store keeps ReasonTracked among its reasons while set
}
Override is what the user set on a pull request that the plugin keeps.
type PR ¶
type PR struct {
Ref Ref
Title string
Author string
State string // OPEN, MERGED, CLOSED
IsDraft bool
HeadOid string
HeadBranch string
BaseBranch string
IsFork bool
ChecksState string // SUCCESS, FAILURE, PENDING, "" (no checks)
ReviewDecision string // APPROVED, CHANGES_REQUESTED, REVIEW_REQUIRED, "" (no required reviews)
ReviewRequests []string // current pending reviewers: logins and "team:org/slug"
URL string
CreatedAt time.Time
UpdatedAt time.Time
MergedAt time.Time
ClosedAt time.Time
BodyEditedAt time.Time
ChangedFiles int
LastSeenAt time.Time // last time a search or a by-ref read returned it
Reasons []string // ownership reasons, sorted; empty means it left scope
Workspace Workspace // zero when none
FailingChecks []FailingCheck
Mergeable string // MERGEABLE, CONFLICTING, UNKNOWN, "" (not read)
MergeableAt time.Time // when it was first seen CONFLICTING; zero otherwise
}
PR is a pull request as the plugin's store keeps it.
type PullRequest ¶
PullRequest is a pull request as a read returned it: the facts the decide rules read and the head repository's owner.
type Ref ¶
type Ref struct {
Owner string `json:"owner"`
Repo string `json:"repo"`
Number int `json:"number"`
}
type Review ¶
type Review struct {
ID string
State string
Author string
SubmittedAt time.Time
CommitOid string
// HasContent is set by the author queries only. GitHub requires a body or
// comments on the states other than APPROVED; an approval counts only
// with inline comments, as reading every body would weigh the query.
HasContent bool
// ByViewer is set by the queries that ask GitHub whether the viewer wrote the review.
ByViewer bool
}
type Workspace ¶
type Workspace struct {
// Manager owns the workspace; ID is its id there.
Manager string `json:"manager,omitempty"`
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 is the repository's main checkout on the pull request's branch,
// which the loop never removes.
IsMain bool `json:"is_main"`
}
Workspace is the workspace a pull request is linked to.