Documentation
¶
Index ¶
- type Author
- type CheckSuite
- type CheckSuiteNode
- type CheckSuites
- type Commit
- type CommitContextsQuery
- type CommitSuitesQuery
- type Context
- type Edge
- type EdgeNode
- type EdgeParent
- type EdgeRootNode
- type Error
- type History
- type Manager
- type NodeStatus
- type PageInfo
- type ParentsEdge
- type Query
- type Ref
- type Repository
- type RollupCheckRun
- type RollupContext
- type RollupStatusContext
- type StatusCheckRollup
- type StatusCheckRollupContexts
- type Target
- type TargetCommit
- type Workflow
- type WorkflowRun
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckSuite ¶ added in v1.1.0
CheckSuite represents the information about the check suite obtained from Github
type CheckSuiteNode ¶ added in v1.1.0
type CheckSuiteNode struct {
WorkflowRun WorkflowRun
}
CheckSuiteNode represents the information about the check suite information of the Node.
It deliberately does not select the nested checkRuns connection. Check runs are read from statusCheckRollup.contexts instead: nesting checkRuns under checkSuites multiplied the query's node count by suites × runs for every commit, and made whether a run was visible at all depend on where its suite happened to sort. This selection is only needed for a required name that is the name of a *workflow* rather than of an individual run.
type CheckSuites ¶ added in v1.1.0
type CheckSuites struct {
TotalCount githubv4.Int
PageInfo PageInfo
Nodes []CheckSuiteNode
}
CheckSuites represents the information about the check suite of a slice of Nodes
type Commit ¶
type Commit struct {
SHA string
Message string
Parents []Commit
StatusSuccess bool
// ChecksSummary explains, one line per required check name, why
// StatusSuccess came out the way it did. Empty when no specific check names
// were requested and the GitHub status rollup was used instead.
ChecksSummary []string
AuthoredDate time.Time
AuthorName string
SpecificCheckPassed bool
// contains filtered or unexported fields
}
Commit represents a specific GitHub commit
func PickFirstParentCommits ¶
PickFirstParentCommits recover the first parent commit of a commit history from a repository
func (*Commit) ChecksTruncated ¶ added in v1.1.11
ChecksTruncated reports whether some of this commit's check data was left unread because a connection had further pages. A commit that already passed needs no more data; one that did not may only be failing because the deciding check sits on a page nobody fetched.
type CommitContextsQuery ¶ added in v1.1.11
type CommitContextsQuery struct {
Repository struct {
Object struct {
Commit struct {
StatusCheckRollup struct {
Contexts StatusCheckRollupContexts `graphql:"contexts(first: $contextsNumber, after: $contextsAfter)"`
}
} `graphql:"... on Commit"`
} `graphql:"object(oid: $oid)"`
} `graphql:"repository(owner: $owner, name: $name)"`
}
CommitContextsQuery fetches one further page of a single commit's status-check rollup contexts.
type CommitSuitesQuery ¶ added in v1.1.11
type CommitSuitesQuery struct {
Repository struct {
Object struct {
Commit struct {
CheckSuites CheckSuites `graphql:"checkSuites(first: $checkSuitesNumber, after: $suitesAfter)"`
} `graphql:"... on Commit"`
} `graphql:"object(oid: $oid)"`
} `graphql:"repository(owner: $owner, name: $name)"`
}
CommitSuitesQuery fetches one further page of a single commit's check suites.
type Edge ¶ added in v1.1.0
type Edge struct {
Node EdgeRootNode
}
Edge represents the information about a edge element
type EdgeParent ¶ added in v1.1.0
type EdgeParent struct {
Node EdgeNode
}
EdgeParent represents the information about a parent node
type EdgeRootNode ¶ added in v1.1.0
type EdgeRootNode struct {
Parents ParentsEdge `graphql:"parents(first: $parentsNumber)"`
Oid githubv4.String
Message githubv4.String
AuthoredDate githubv4.DateTime
Author Author
StatusCheckRollup StatusCheckRollup
CheckSuites CheckSuites `graphql:"checkSuites(first: $checkSuitesNumber)"`
Status NodeStatus
}
EdgeRootNode represents the information about a edge root node
type History ¶ added in v1.1.0
type History struct {
Edges []Edge
}
History represents the information about a slice of Edges
type Manager ¶ added in v1.1.0
Manager represents the information necessary in Github to manage the repository
func (*Manager) ChangeBranchHead ¶ added in v1.1.0
ChangeBranchHead change the head of a branch TODO remove v3 client when implemented in v4
func (*Manager) GetCommits ¶ added in v1.1.0
func (gm *Manager) GetCommits(owner, repo, branch string, lastCommitsNumber int, specificChecksNames string, sep string, acceptSkippedChecks bool, contextsNumber, checkSuitesNumber int) ([]Commit, error)
GetCommits recover the commits for a specific repository in a specific branch. When specificChecksNames is set, every name it contains must be satisfied on a commit for its StatusSuccess to be true; acceptSkippedChecks additionally lets a check GitHub reports as SKIPPED count as satisfied.
func (*Manager) TopUpChecks ¶ added in v1.1.11
TopUpChecks reads the check data that did not fit in the first page and folds it into the commit's verdict.
Both statusCheckRollup.contexts and checkSuites are capped at 100 entries per page and real repositories exceed that, so a commit can look unsatisfied purely because the deciding check sat on a page nobody asked for. Rather than judging on a partial view, fetch the rest — but only when it can still change the answer, which is why callers invoke this per commit they actually examine instead of for the whole history up front. It stops as soon as every required name is satisfied.
type NodeStatus ¶ added in v1.1.0
type NodeStatus struct {
Contexts []Context
}
NodeStatus represents the information about a slice of Contexts.
Commit.status.contexts is a plain list rather than a connection, so this is always the complete set of classic commit statuses — there is nothing to paginate.
type PageInfo ¶ added in v1.1.11
PageInfo carries a connection's cursor so the pages that did not fit can be fetched on demand.
type ParentsEdge ¶ added in v1.1.0
type ParentsEdge struct {
Edges []EdgeParent
}
ParentsEdge represents the information about the parents edge
type Query ¶ added in v1.1.0
type Query struct {
Repository Repository `graphql:"repository(owner: $owner, name: $name)"`
}
Query represents the information obtained in a Github Query
type Ref ¶ added in v1.1.0
type Ref struct {
Target Target
}
Ref represents the information about a ref element
type Repository ¶ added in v1.1.0
type Repository struct {
Ref Ref `graphql:"ref(qualifiedName: $branch)"`
}
Repository represents the information obtained about a repository in a Github Query
type RollupCheckRun ¶ added in v1.1.11
type RollupCheckRun struct {
Name githubv4.String
Status githubv4.String
Conclusion githubv4.String
}
RollupCheckRun is the CheckRun member of the statusCheckRollup contexts union.
type RollupContext ¶ added in v1.1.11
type RollupContext struct {
Typename githubv4.String `graphql:"__typename"`
StatusContext RollupStatusContext `graphql:"... on StatusContext"`
CheckRun RollupCheckRun `graphql:"... on CheckRun"`
}
RollupContext is one entry of statusCheckRollup.contexts, a union of StatusContext and CheckRun. Typename says which member is populated.
type RollupStatusContext ¶ added in v1.1.11
RollupStatusContext is the StatusContext member of the statusCheckRollup contexts union: a classic commit status, as reported through the rollup.
type StatusCheckRollup ¶ added in v1.1.0
type StatusCheckRollup struct {
State githubv4.String
Contexts StatusCheckRollupContexts `graphql:"contexts(first: $contextsNumber)"`
}
StatusCheckRollup represents the information about the status check of rollup
type StatusCheckRollupContexts ¶ added in v1.1.0
type StatusCheckRollupContexts struct {
TotalCount githubv4.Int
PageInfo PageInfo
Nodes []RollupContext
}
StatusCheckRollupContexts represents the information about the status check of rollup contexts.
This is where check runs are read from. GitHub returns the latest run per check name here, so re-runs of the same check arrive as one entry rather than one per attempt, and the list is flat rather than grouped by suite.
type Target ¶ added in v1.1.0
type Target struct {
Commit TargetCommit `graphql:"... on Commit"`
}
Target represents the target of a specific commit
type TargetCommit ¶ added in v1.1.0
type TargetCommit struct {
History History `graphql:"history(first: $commitsNumber)"`
}
TargetCommit represents the information about a commit history
type WorkflowRun ¶ added in v1.1.0
type WorkflowRun struct {
Workflow Workflow
CheckSuite CheckSuite
}
WorkflowRun represents the information about the workflow run execution