Documentation
¶
Overview ¶
Package ghrel implements pubgh.ReleaseReader and pubgh.Publisher with go-github.
New accepts an already-authenticated github.Client so token text never enters domain values or error strings. NewAuthenticated builds that client from a rel.Secret for the public API or a GITHUB_API_URL enterprise/stub base. FindDraft paginates repository releases once and returns the unique tag match, WaitAssets paginates release assets once and returns the current view, Get maps one release, and Publish undrafts a release by sending draft=false only. Polling lives in pubgh.Publish. API failures are classified as absent, auth, retryable, or malformed.
Index ¶
- type Client
- func (c *Client) Fetch(ctx context.Context, request pkgrepo.ReleaseRequest, destination *os.Root) (pkgrepo.Release, error)
- func (c *Client) FindDraft(ctx context.Context, repository pubgh.Repository, tag rel.Tag) (pubgh.Release, error)
- func (c *Client) Get(ctx context.Context, repository pubgh.Repository, release pubgh.ReleaseID) (pubgh.Release, error)
- func (c *Client) Publish(ctx context.Context, repository pubgh.Repository, release pubgh.ReleaseID) error
- func (c *Client) WaitAssets(ctx context.Context, repository pubgh.Repository, release pubgh.ReleaseID) (pubgh.AssetsView, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client reads GitHub Releases and undrafts them through go-github.
func New ¶
New constructs a Client around an already-authenticated go-github client.
The caller supplies authentication. Token text must not be stored on Client or included in returned errors.
func NewAuthenticated ¶
NewAuthenticated constructs a Client for token at the given GitHub API.
An empty apiURL selects the public https://api.github.com client. A non-empty apiURL uses github.Client.WithEnterpriseURLs, with serverURL as the upload base when set and apiURL otherwise. Token text is applied only as Authorization and never stored on Client.
func (*Client) Fetch ¶
func (c *Client) Fetch( ctx context.Context, request pkgrepo.ReleaseRequest, destination *os.Root, ) (pkgrepo.Release, error)
Fetch implements pkgrepo.ReleaseSource.
It requires one exact published, non-prerelease tag, paginates the complete asset list, rejects duplicate or incomplete asset metadata, resolves the tag ref to its final commit, and downloads every asset into destination. Each download is streamed through SHA-256 and must match both GitHub's digest and size before Fetch succeeds.
func (*Client) FindDraft ¶
func (c *Client) FindDraft( ctx context.Context, repository pubgh.Repository, tag rel.Tag, ) (pubgh.Release, error)
FindDraft implements pubgh.ReleaseReader.
It paginates repository releases once and returns the unique release whose tag name equals tag, including a published (non-draft) match. Deciding what a non-draft means is the engine's job. Zero matches return pubgh.ErrNoDraft. Two or more matches return pubgh.ErrAmbiguousRelease. pubgh.Publish owns the poll budget.
func (*Client) Get ¶
func (c *Client) Get( ctx context.Context, repository pubgh.Repository, release pubgh.ReleaseID, ) (pubgh.Release, error)
Get implements pubgh.ReleaseReader.
func (*Client) Publish ¶
func (c *Client) Publish( ctx context.Context, repository pubgh.Repository, release pubgh.ReleaseID, ) error
Publish implements pubgh.Publisher.
It sends a PATCH that sets draft to false and omits every other release field so GitHub cannot clobber name, body, tag, or target commitish.
func (*Client) WaitAssets ¶
func (c *Client) WaitAssets( ctx context.Context, repository pubgh.Repository, release pubgh.ReleaseID, ) (pubgh.AssetsView, error)
WaitAssets implements pubgh.ReleaseReader.
It paginates release assets once and returns the current view. It does not decide readiness: the caller validates counts, names, states, and digests. pubgh.Publish owns the poll budget.