Documentation
¶
Overview ¶
Package workgh reads GitHub issues, read-only, into nova-work's tree model (internal/workfile). It is the recut of the GitHub capture that nova-work carried before (its GraphQL page query, its mutation refusal, its page chain), widened to every field SPEC-WORK-V1 section 1.3 names and to every repository of an organization, with no field cut at a bound: a connection longer than one page is fetched to its end, never truncated.
Every call goes through one seam, Query, and is counted; the production Query runs `gh api graphql` and refuses any document that is not a query, so this package cannot write to GitHub.
Index ¶
Constants ¶
const MinPageSize = 5
MinPageSize is the smallest page a failed page is retried at.
Variables ¶
var ErrBudget = errors.New("call budget spent")
ErrBudget is returned when the next call would pass the fetcher's budget.
Functions ¶
func DefaultProgram ¶
func DefaultProgram() string
DefaultProgram is the GitHub CLI the production Query runs when none is named.
func RefuseMutation ¶
RefuseMutation refuses a GraphQL document that is not a plain query.
Types ¶
type Fetcher ¶
type Fetcher struct {
Q Query
// PageSize is the issues asked for per page, 1 to 100. A page GitHub
// fails to answer is asked again at half the size, down to MinPageSize.
PageSize int
// MaxCalls is the budget: the call past it is refused with ErrBudget.
MaxCalls int
// Log takes one line per retried page; nil is silent.
Log io.Writer
Calls int
Points int
Remaining int // GraphQL points left in the hour after the last call, -1 before any
}
Fetcher reads repositories and issues through Q, counting every call (Calls) and the GraphQL points GitHub charged for them (Points).
func (*Fetcher) Issues ¶
Issues reads every issue of the repository, open and closed, with its full contents, sorted by number. It refuses a fetch whose count disagrees with the count GitHub gave (the repository changed while it was read).
type Query ¶
Query runs one read-only GraphQL document with its variables and returns the raw response body.
func GhQuery ¶
GhQuery is the production Query: `<program> api graphql --input -` with the document and variables as the JSON body on stdin. It refuses a document that is not a plain query before anything runs.