Documentation
¶
Overview ¶
Package github implements the CI cache Backend against the GitHub Actions cache (Cache Service v2). It speaks the Twirp JSON API at ACTIONS_RESULTS_URL (authenticated with ACTIONS_RUNTIME_TOKEN) for save/restore, uploads/downloads content through the returned Azure Blob SAS URLs, and uses the public REST caches API for list/delete.
Save/restore of content require the Actions runtime token and results URL, which are only present inside a GitHub Actions runner; outside a runner those operations return errUtils.ErrCacheUnavailable. List/delete are pure cache administration over the public REST API and work anywhere a GitHub token and the repository (owner/repo) can be resolved, so NewBackend constructs an admin-capable backend even outside a runner.
Index ¶
- func NewBackend(opts cache.Options) (cache.Backend, error)
- type Backend
- func (b *Backend) Delete(ctx context.Context, key string) error
- func (b *Backend) List(ctx context.Context, opts cache.ListOptions) ([]cache.Entry, error)
- func (b *Backend) Name() string
- func (b *Backend) Restore(ctx context.Context, key string, restoreKeys []string) (string, io.ReadCloser, error)
- func (b *Backend) Save(ctx context.Context, key string, data io.Reader, size int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBackend ¶
NewBackend constructs the GitHub Actions cache backend.
List/delete (cache administration) work anywhere: they use the public REST caches API authenticated with an ordinary GitHub token and the repository's owner/repo (resolved from GITHUB_REPOSITORY or the local git remote). Save and restore of content additionally require the Actions runtime token and results URL (ACTIONS_RUNTIME_TOKEN + ACTIONS_RESULTS_URL), which are only present inside a GitHub Actions runner; when they are absent the returned backend has no runtime client and Save/Restore report errUtils.ErrCacheUnavailable.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend implements cache.Backend using the GitHub Actions cache.
func (*Backend) Delete ¶
Delete removes a cache entry by key via the REST caches API. Missing keys are a no-op.