sonarsource/S3 Cache action
Cache files on S3 with branch-specific paths for granular permissions
View on GitHubTrust Signals
- Scorecard Score
- not yet scored
- Maintenance Recency
- Stale
- License
- None
Inputs
| name | description | required | default |
|---|---|---|---|
| path | A list of files, directories, and wildcard patterns to cache and restore | yes | — |
| key | An explicit key for restoring and saving the cache | yes | — |
| restore-keys | An ordered list of prefix-matched keys to use for restoring stale cache if no cache hit occurred for key | — | — |
| upload-chunk-size | The chunk size used to split up large files during upload, in bytes | — | — |
| enableCrossOsArchive | When enabled, allows to save or restore caches that can be restored or saved respectively on other platforms | — | false |
| fail-on-cache-miss | Fail the workflow if cache entry is not found | — | false |
| lookup-only | Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache | — | false |
| environment | Environment to use ('dev' or 'prod', 's3' backend only). | — | prod |
| fallback-branch | Explicit fallback branch for restore keys (pattern 'branch-*', 's3' backend only). Always honoured when set, regardless of 'fallback-to-default-branch'. If not set, the repository default branch is used when 'fallback-to-default-branch' is true. | — | — |
| fallback-to-default-branch | When enabled, automatically adds a fallback restore key pointing to the default branch cache. Only applies to the S3 backend. | — | true |
| backend | Force cache backend ('github' or 's3'). If not set, falls back to the CACHE_BACKEND environment variable if defined, then automatically determined based on repository visibility. | — | — |
| import-github-cache | Import GitHub cache to S3 when no S3 cache exists (migration mode). Enabled by default when using S3 backend. Set to 'false' to disable, or control via the CACHE_IMPORT_GITHUB environment variable. | — | "" |
Outputs
| name | description |
|---|---|
| cache-hit | A boolean value to indicate an exact match was found for the primary key |
| cache-matched-key | The cache key for which a match was found. Equals the primary key on an exact hit, one of the user-provided restore keys on a partial hit, or empty when no match was found. |
| restore-key-hit | The restore key that was prefix-matched. Populated only when `cache-hit` is `false` AND a restore key matched (partial hit). Empty on exact hits and on full misses — i.e. set if this was a partial restore. |
| backend | The cache backend that was actually used for this invocation (`github` or `s3`). |
| cache-size-bytes | Total size in bytes of the cached path(s) at restore-time. Requires GNU du (Linux); empty on other platforms. The action also writes a per-invocation JSON record to /tmp/ci-metrics/cache-${step}.json for the pipeline-runtime-metrics job-completed hook to ingest. The JSON record is written on all platforms; only the size fields are null on non-Linux. |