Skip to main content
Save downloaded packages and completed builds so later jobs finish sooner. Each job starts on a fresh computer. A cache keeps a saved copy of reusable files for later jobs. You can also save build and type-check results. Celesto saves Turborepo task results automatically. See JavaScript and TypeScript for npm and pnpm recipes, plus guidance for Nx.

Add caching to a workflow

Use your setup action’s cache option or a compatible actions/cache step. The published cache guide includes complete Node.js and Python workflows and measured results. For a Python project with a committed requirements.txt that includes pytest, save this workflow as .github/workflows/python-tests.yml. First complete the CI quickstart for the repository.
.github/workflows/python-tests.yml
The key identifies compatible files using the operating system, processor architecture, Python version, and dependency file. The fallback prefix lets pip reuse older downloads when dependencies change. Keep the install step: cached downloads help pip install the dependencies your project requests.

Verify reuse

Run the workflow successfully, then rerun it with the same dependency file. Inspect the cache step for restore and save messages. A cache hit means a matching archive was found; compare the complete job duration to see whether it saves time. A miss means the job needs to fetch dependencies again. Check the key, saved paths, access scope, and expiry. Keep installation steps able to recover from a miss. Use fail-on-cache-miss only when you intentionally want a missing cache to fail the job. Caches created on GitHub-hosted runners remain in GitHub’s separate store. Expect an initial miss when moving a workflow to Celesto.

Understand access and expiry

Celesto scopes entries to the workspace, repository, Git ref (a branch or pull-request reference), and cache version. The version describes details such as saved paths and compression. Matching text keys alone do not grant access: Celesto checks the running job’s GitHub runtime token. A read-only cache grant cannot save entries.

Share default-branch caches with pull requests

A pull request can restore an authorized base-branch or default-branch cache. The base branch is the branch the pull request targets; the default branch is the repository’s primary branch, often main. The job’s token determines which references it can read. An entry saved under a pull-request reference stays in that scope. Use restore-keys to find a compatible saved entry when the current run’s exact key is new. The action tries the primary key and then the listed prefixes within the authorized scopes. This follows the scope model described in the published Celesto cache guide.

Storage limits and cleanup

These defaults can change. An hourly cleanup removes idle entries, then the least recently used entries as needed to meet storage limits. Expiry is therefore not an exact deletion timestamp. A restore updates the last-access time. The current cache release has no separate storage charge. Job runtime still consumes workspace credit. Use artifacts or durable storage for results you need to keep.

Check cache size and usage

Celesto currently has no customer-facing cache usage view or cache list API. GitHub’s cache page and gh cache show GitHub’s separate store. For current repository and workspace usage, contact support with your workspace name or ID and repository (owner/name). To estimate an individual entry, inspect the compressed archive size in the cache action’s save logs. Run du -sh on the saved directories to see their size on the job computer. Total repository and workspace usage also includes older keys and entries from other branches. Prune old task results before saving a new archive, and save task caches on the default branch to reduce duplicate entries. Pruning the local directory reduces future archives; existing saved entries follow the cleanup rules above. Leave room for dependency caches and overlapping entries while older keys expire.

Reduce cache restore time

A restore includes downloading a compressed archive, unpacking it, and writing its files to disk. Many small files can take longer to unpack than to download. Compare both stages when measuring restore time. Compare the complete job on a cache miss and a hit, including restore, installation, tasks, and save. Use the action’s timestamps and logs to separate transfer time from extraction time where available.
  • Compare a package download cache with an installed node_modules cache. Restoring fewer files and then installing can be faster than extracting a large installed tree.
  • Save only the paths your tools reuse. Keep logs, temporary files, and old task results out of the archive.
  • For a monorepo (several packages in one repository), cache task results separately from dependencies. Skipping a build can save more time than accelerating package downloads.
  • Compare runner sizes when decompression or file creation dominates. Measure complete job time and cost for your workload.
The cache benchmark reports download and extraction separately for one workload. Use your own timings to choose between a package cache, installed dependencies, and task results.

Start with a fresh cache

In the example above, change pip-v1 to pip-v2 in both key and every restore-keys prefix. Commit the change and run the workflow. Updating all fallback prefixes prevents restoration through the old prefix. This bypasses old entries while they remain subject to normal cleanup. It does not delete them. Keep tokens, credentials, and private keys out of cached paths.

Request deletion

GitHub’s cache page and gh cache manage GitHub’s store. Celesto currently handles early cache deletion through support and has no customer cache list or delete interface. Email aniket@celesto.ai with:
Request confirmation when deletion is complete. If you need to prevent the same data from being saved again, remove the cache step or affected paths before starting another run. If a cache contained a credential, revoke or rotate it immediately; changing the cache key does not remove the exposure. To save Docker image layers between jobs, see Cache image layers between jobs. Saved layers count toward the same storage limits.
Last modified on November 5, 2026