Skip to main content

cache

Creates, updates, deletes, gets or lists a cache resource.

Overview

Namecache
TypeResource
Idgithub.actions.cache

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
actions_cachesarrayArray of caches
total_countintegerTotal number of caches

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_actions_cache_listselectowner, repoper_page, page, ref, key, sort, directionLists the GitHub Actions caches for a repository.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
delete_actions_cache_by_iddeleteowner, repo, cache_idDeletes a GitHub Actions cache for a repository, using a cache ID.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
delete_actions_cache_by_keydeleteowner, repo, keyrefDeletes one or more GitHub Actions caches for a repository, using a complete cache key. By default, all caches that match the provided key are deleted, but you can optionally provide a Git ref to restrict deletions to caches that match both the provided key and the Git ref.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
cache_idintegerThe unique identifier of the GitHub Actions cache.
keystringA key for identifying the cache.
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.
directionstringThe direction to sort the results by.
keystringAn explicit key or prefix for identifying the cache
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
refstringThe full Git reference for narrowing down the cache. The ref for a branch should be formatted as refs/heads/<branch name>. To reference a pull request use refs/pull/<number>/merge.
sortstringThe property to sort the results by. created_at means when the cache was created. last_accessed_at means when the cache was last accessed. size_in_bytes is the size of the cache in bytes.

SELECT examples

Lists the GitHub Actions caches for a repository.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

SELECT
actions_caches,
total_count
FROM github.actions.cache
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
AND ref = '{{ ref }}'
AND key = '{{ key }}'
AND sort = '{{ sort }}'
AND direction = '{{ direction }}'
;

DELETE examples

Deletes a GitHub Actions cache for a repository, using a cache ID.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

DELETE FROM github.actions.cache
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND cache_id = '{{ cache_id }}' --required
;