Skip to content
Skills Library
DevOps & cloud · Automation

actions-cache-and-artifacts

/actions-cache-and-artifacts

Use when caching a dependency directory in a GitHub Action, uploading or downloading a workflow artifact, installing a toolchain or an exact package-manager version into the runner's tool cache, or storing a keyed blob against the Actions cache or an S3-compatible bucket. Also use when: ACTIONS_RESULTS_URL, ACTIONS_RUNTIME_TOKEN, tool cache, blob store, ActionCache, Artifact, GitHubCacheBlobStore, BlobStore, S3Config, ToolInstaller, PackageManagerInstaller, CacheKey, hashFiles, restore keys, withNamespace, cache bust, stage-then-swap, Twirp retry, @azure/storage-blob confinement

Repository
effected ↗
Licence
MIT
Last repository change
13.11.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when caching a dependency directory in a GitHub Action, uploading or downloading a workflow artifact, installing a toolchain or an exact package-manager version into the runner's tool cache, or storing a keyed blob against the Actions cache or an S3-compatible bucket. Also use when: ACTIONS_RESULTS_URL, ACTIONS_RUNTIME_TOKEN, tool cache, blob store, ActionCache, Artifact, GitHubCacheBlobStore, BlobStore, S3Config, ToolInstaller, PackageManagerInstaller, CacheKey, hashFiles, restore keys, withNamespace, cache bust, stage-then-swap, Twirp retry, @azure/storage-blob confinement

Original author description

Use when caching a dependency directory in a GitHub Action, uploading or downloading a workflow artifact, installing a toolchain or an exact package-manager version into the runner's tool cache, or storing a keyed blob against the Actions cache or an S3-compatible bucket. Also use when: ACTIONS_RESULTS_URL, ACTIONS_RUNTIME_TOKEN, tool cache, blob store, ActionCache, Artifact, GitHubCacheBlobStore, BlobStore, S3Config, ToolInstaller, PackageManagerInstaller, CacheKey, hashFiles, restore keys, withNamespace, cache bust, stage-then-swap, Twirp retry, @azure/storage-blob confinement

How it works

  1. What you have
  2. Standards
  3. Footguns
  4. Additional resources
Original SKILL.md headings · 45 lines, 903 words
SKILL.md preview
---
name: actions-cache-and-artifacts
description: "Use when caching a dependency directory in a GitHub Action, uploading or downloading a workflow artifact, installing a toolchain or an exact package-manager version into the runner's tool cache, or storing a keyed blob against the Actions cache or an S3-compatible bucket. Also use when: ACTIONS_RESULTS_URL, ACTIONS_RUNTIME_TOKEN, tool cache, blob store, ActionCache, Artifact, GitHubCacheBlobStore, BlobStore, S3Config, ToolInstaller, PackageManagerInstaller, CacheKey, hashFiles, restore keys, withNamespace, cache bust, stage-then-swap, Twirp retry, @azure/storage-blob confinement"
---

# Actions cache and artifacts

The storage tier of `@effected/github-actions`: caches, artifacts, blobs, and installed tools. `@actions/cache` and `@actions/artifact` are both re-implemented directly against their own HTTP protocols rather than taken as dependencies — either one alone drags a tree larger than this whole package.

For the general Effect v4 service/layer rules this package follows — `Context.Service`, `provideMerge` vs `mergeAll`, memoization by reference — see `effect-v4-services-layers`; this skill carries only the storage-specific instance of each.

## What you have

| Need | Service | Layer | `R` (besides itself) | Error |
| --- | --- | --- | --- | --- |
| Archive and restore a dependency directory across jobs | `ActionCache` | `ActionCache.layer` | `ActionEnvironment \| HttpClient \| FileSystem \| Path \| ChildProcessSpawner` | `ActionCacheError` |
| Upload, list, get, download or delete a workflow artifact | `Artifact` | `Artifact.layer` | same five | `ArtifactError` |
| A keyed blob with caller-owned metadata, in the Actions cache | `BlobStore` over `GitHubCacheBlobStore.layer` | `GitHubCacheBlobStore.layer` | `HttpClient \| ActionEnvironment` | `BlobStoreError \| BlobEnvelopeError` |
| Same, in S3 / R2 / MinIO / Spaces | `BlobStore` over `BlobStore.layerS3(config)` | `BlobStore.layerS3(config)` | `HttpClient \| ActionOutputs \| Digest.Digest \| Mac.Mac` | same |
| A cache key, its restore-key ladder, and `hashFiles` | `CacheKey` | none — a pure `Schema.Class` with `Effect.fn` statics | `FileSystem` (`hashFiles`), `+ Path` (`matchingFiles`) | `CacheKeyError` |
| Download, extract and cache a toolchain | `ToolInstaller` | `ToolInstaller.layer` | `ActionEnvironment \| FileSystem \| Path \| HttpClient \| ChildProcessSpawner` | `ToolInstallerError` |
| Pin and install an exact npm/pnpm/bun on the runner | `PackageManagerInstaller` | `PackageManagerInstaller.layer` | `ActionEnvironment \| FileSystem \| Path \| ChildProcessSpawner \| ToolInstaller` | `PackageManagerInstallerError` |

`ActionRuntime.layer` provides none of the six services above by default — see `actions-runtime` for why, and for the one-line cost of taking one (`Action.run(program, { layer: ActionCache.layer })`).

## Standards

- **Take a storage service as an explicit one-line extra layer — never expect one from `ActionRuntime.layer`.** Their requirements are already satisfied by the runtime's own services; the runtime simply doesn't provide them by default.
- **Only reach the Actions results backend from a `uses:` step.** `ActionCache`, `Artifact` and `GitHubCacheBlobStore` all need `ACTIONS_RESULTS_URL`/`ACTIONS_RUNTIME_TOKEN`, which the runner injects only into action execution contexts, not `run:` shell steps. `BlobStore.layerS3` and `ToolInstaller` need neither and work identically from either.
- **Pass `ActionCache`'s literal glob pattern list to both `save` and `restore`.** `save` resolves patterns before archiving, but the cache *version* on both sides hashes the literal pattern list, not the resolved paths — a mismatched literal list makes a saved entry invisible on restore.
- **Never share a heavy-dependency adapter through an internal helper.** Each Azure-touching module carries its own small adapter rather than importing one from a shared module — a consumer that imports only a light service must be structurally unable to link the heavy dependency into its bundle.
- **Stage into a temp directory under the cache root, then rename into place — never copy straight to a tool's final destination.** A copy left partial by a failure looks like a completed install to a directory-presence check, and every later run then uses a broken toolchain silently.
- **Read both the camelCase and snake_case spelling of a field from an internal, reverse-engineered wire response**, and key retry on a structural `kind`, never a formatted message substring — a reworded error string must never become a silent policy change in what gets retried.
- **Let everything that can go through a core contract do so.** `HttpClient` for downloads, `ChildProcessSpawner` for archive extraction, `FileSystem` for reading file contents — `node:` imports in this tier are licensed only for what core genuinely cannot do yet (HMAC, gzip framing), never as a blanket substitute.

## Footguns

- `PackageManagerInstaller.install` can answer an ambient package manager with **no `binDir`** — a consumer that always reads `binDir` breaks on that branch. See `references/installers.md`.
- A hex-fed hash accumulator in `CacheKey.hashFiles` produces a plausible-looking digest that never matches any cache entry written by `@actions/glob`'s `hashFiles` — the per-file digest must feed the accumulator as binary. See `references/cache-and-keys.md`.
- Resolved cache paths reaching `tar` via argv instead of a manifest file blow past the OS argv limit on a large glob resolution. See `references/cache-and-keys.md`.
- A legacy, unframed blob decodes as a typed clean miss against `BlobEnvelope`, on purpose — treat it as "not cached yet," never as a corrupt read. See `references/blob-stores.md`.
- The Actions-cache Twirp protocol hands back an Azure blob URL for the payload, so the Azure-touching module count is three, not the two a casual read of the cache/artifact split suggests. See `references/blob-stores.md`.

## Additional resources

- [references/cache-and-keys.md](references/cache-and-keys.md) — `ActionCache`'s glob-vs-literal path handling in full, the manifest-file tar invocation, and `CacheKey`'s restore-key ladder, `hashFiles` byte-compatibility and `matchingFiles` discovery. Load when: designing a cache step, a restore-key fallback policy, or a file-hash-derived key.
- [references/blob-stores.md](references/blob-stores.md) — the results-backend confinement rule, `BlobEnvelope`'s wire format and error union in full, the Azure three-module confinement with its reachability test, the transport seam (`FileBlobTransfer`/`DataBlobTransfer`), and the Twirp field-spelling and retry discipline. Load when: storing a keyed blob, reviewing why a cache/artifact call reports `misconfigured`, or auditing the Azure import boundary.
- [references/installers.md](references/installers.md) — `ToolInstaller`'s stage-then-swap cache write, its layout contract with the runner, `PackageManagerInstaller`'s ambient-vs-cached branch, and the `node:`-import accounting for this tier. Load when: installing a toolchain or an exact package-manager version, or reviewing a `node:` import in this package.
Files in this package (4)
  • SKILL.md 7 KB
  • references/blob-stores.md 12 KB
  • references/cache-and-keys.md 6 KB
  • references/installers.md 8 KB

Versions

RepositoryScoreLicence
This page · spencerbeggs/effected90MIT
spencerbeggs/effected90MIT

Database snapshot: 13.11.2026 · package version d38c8d98b9b6 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100github-actions-cache-optimization
    GitHub Actions cache analysis and optimization. Use when investigating cache bloat, finding stale caches, optimizing keys, or comparing cache usage across repos.
  • 90actions-runtime
    Use when writing or reviewing a GitHub Action's pre/main/post entry point on @effected/github-actions — wiring Action.run, ActionRuntime.layer, the ActionServices union, an extra ActionRunOptions.layer, or deciding whether ActionCache, Artifact or GitHubCacheBlobStore belong in the runtime.
  • 100azure-storage-blob-py
    Azure Blob Storage SDK for Python. Use for uploading, downloading, listing blobs, managing containers, and blob lifecycle.
  • 100azure-storage-blob-py
    Azure Blob Storage SDK for Python. Use for uploading, downloading, listing blobs, managing containers, and blob lifecycle.
  • 100azure-storage-blob-py
    Azure Blob Storage SDK for Python. Use for uploading, downloading, listing blobs, managing containers, and blob lifecycle.
  • 100azure-storage-blob-java
    Build blob storage applications with Azure Storage Blob SDK for Java. Use when uploading, downloading, or managing files in Azure Blob Storage, working with containers, or implementing streaming da...

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.