Documentation
¶
Overview ¶
Package ghsource is the read-only GitHub Projects v2 client behind `aeman migrate`: it loads one project board over the GraphQL API and maps it onto the domain board.Board the migration consumes. It deliberately carries no write path — the git layout is the only store aeman writes to.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBoardNotFound is returned when a project cannot be located. ErrBoardNotFound = errors.New("project board not found") // ErrBadCredentials is GitHub rejecting the caller's token (401/403). It // is a distinct condition from a board being missing: the token is dead — // expired, revoked, or superseded — and no retry with it will ever work. ErrBadCredentials = errors.New("github rejected the token") )
Sentinel errors returned by the client; callers tell them apart with errors.Is.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client reads GitHub Projects v2 boards over the GraphQL API with a fixed bearer token.
type Doer ¶
Doer is the subset of *http.Client used by the client, so tests can inject a stub transport.
type Export ¶
type Export struct {
Board board.Board
// Items is keyed by item id and covers every card NewBoard sorted into
// Board.Cards, Board.Tasks or the roster.
Items map[string]Item
// ProjectBoardItems counts the items of the retired Project board left
// out of Board: cards in a column and its roster stubs (H15).
ProjectBoardItems int
}
Export is what the reader hands the migration: the domain board, plus what Projects v2 carried per item that the domain card no longer does.
type Field ¶
type Field struct {
ID string
Name string
DataType string
Options []FieldOption
}
Field is a Projects v2 field definition — what the roles are resolved from.
type FieldOption ¶
FieldOption is one single-select choice; a zone is read by its colour.
type Item ¶
type Item struct {
// IsDraft marks a draft-issue card — the kind the boards were made of.
IsDraft bool
// URL is the underlying issue or PR (empty on a draft); it becomes the
// card's link.
URL string
// Events is the action log parsed out of the draft body (or the log
// comment on an issue card), in source order.
Events []board.Event
// Week is the item's Week field as Projects v2 had it. The domain board
// reads a task's week as nothing (K7), so the importer reads it here to
// place a task that had nothing but a week the way schema 3 does (K8).
Week string
// ProjectCard marks an item of the retired Project board: a card in a
// column (a Scope / Epic value) or one of its roster stubs. Project
// cards were removed (H15) and are not imported; the export leaves them
// out of the board altogether.
ProjectCard bool
}
Item is the GitHub side of one project item.
type Option ¶
type Option func(*Client)
Option customises a Client.
func WithEndpoint ¶
WithEndpoint overrides the GraphQL endpoint (used in tests).
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client used for requests.