Add S3 cache provider - #365
Open
gautamg795 wants to merge 1 commit into
Open
Conversation
Add `cache-provider: s3` alongside the github and warpbuild providers, storing caches in an S3 bucket via the standard AWS SDK credential chain. New `s3-bucket` and `s3-prefix` inputs; an empty bucket warns and falls back to the github provider, so a workflow using an unset repository variable still works in forks without S3 credentials. Restores probe the exact key first and fall back to the newest object matching each restore key prefix. Downloads fetch byte ranges concurrently with retries; uploads are multipart. Archive creation and extraction reuse the internal tar helpers from @actions/cache, bundled through a small rollup resolver. Includes unit tests for provider selection and S3 listing pagination, plus an end-to-end test that saves and restores through the built action against MinIO, verifying content integrity, multipart transfer, and restore-key fallback.
teesaelee1998-ux
approved these changes
Jul 26, 2026
Repository owner
deleted a comment from
teesaelee1998-ux
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds
cache-provider: s3alongside the existing github and warpbuild providers, storing caches in an S3 bucket of your choosing. Useful for self-hosted runners on AWS, where a bucket avoids the 10 GB GitHub cache limit and transfers stay inside the VPC. Closes #286.Usage
Notes
@actions/cache's version), with the full cache key as the object name.HeadObject/GetObject, then falls back to the newest object matching each restore-key prefix (paginatedListObjectsV2, newestLastModifiedwins).@aws-sdk/lib-storage; downloads fetch 16 MB byte ranges concurrently with retries and anIf-MatchETag guard against concurrent overwrites.@actions/cache(resolved explicitly in the rollup config so they're bundled), so the on-disk behavior is identical to the GitHub provider.The
READMEincludes a security warning: S3 has no equivalent of GitHub's branch-scoped cache isolation, and this can't be enforced client-side (a malicious job holding write-capable credentials can bypass the action and call S3 directly). Write access must be scoped at the credential level — e.g. an OIDC role restricted to trusted refs — and the docs say so explicitly.Testing
npm test).npm run test:s3-e2e, also a new workflow) that runs the builtdist/restore.js/dist/save.jsagainst MinIO in a container: verifies restored content by hash, that multipart upload engaged, that an exact hit skips the re-save, and that restore-key fallback picks the newest entry. Unlike the credential-gated warpbuild workflow, this runs on any fork or PR — no AWS credentials needed.Full disclosure: this code was written with AI assistance. It has been reviewed by us and has been running in production CI at Convex for over a week before being submitted here.