Documentation
¶
Overview ¶
Package github is the ingestion.ForgeClient adapter for GitHub, backed by google/go-github.
Index ¶
- Variables
- type Client
- func (c *Client) CreateWebhook(ctx context.Context, req ingestion.CreateWebhookRequest) error
- func (c *Client) ListAccessibleRepos(ctx context.Context, req ingestion.ListAccessibleReposRequest) ([]string, error)
- func (c *Client) ListRecentRuns(ctx context.Context, req ingestion.ListRunsRequest) (ingestion.ListRunsResult, error)
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidIdentifier = errors.New("identifier must be in owner/name form")
ErrInvalidIdentifier is returned when a repo identifier isn't "owner/name".
var ErrUnexpectedStatus = errors.New("unexpected status")
ErrUnexpectedStatus is returned when a GitHub API response's status code is neither the expected success code nor 304 Not Modified.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the GitHub-backed ingestion.ForgeClient.
func NewClient ¶
NewClient returns a Client. baseURL overrides the GitHub API endpoint (for tests against a fake server); pass "" to use the real GitHub API.
func (*Client) CreateWebhook ¶
CreateWebhook implements ingestion.ForgeClient.
func (*Client) ListAccessibleRepos ¶ added in v0.11.0
func (c *Client) ListAccessibleRepos(ctx context.Context, req ingestion.ListAccessibleReposRequest) ([]string, error)
ListAccessibleRepos implements ingestion.ForgeClient. Returns every repo (owner, collaborator, and organization-member repos) the token can see, newest-pushed first, excluding archived and forked repos -- neither is something the registration UI's picker should ever offer to track.
func (*Client) ListRecentRuns ¶ added in v0.4.0
func (c *Client) ListRecentRuns(ctx context.Context, req ingestion.ListRunsRequest) (ingestion.ListRunsResult, error)
ListRecentRuns implements ingestion.ForgeClient. The run-list request is conditional (If-None-Match/ETag); a 304 short-circuits before any jobs are fetched, since nothing about the run list changed. go-github's typed client isn't used here -- CheckResponse treats a 304 as an API error, so a plain net/http request keeps the conditional-GET contract explicit and testable against a fake server.