shared-actions/cache/action.yml
Michael Seele 1e68ce68c7
All checks were successful
validate-shared-actions / validate-shared-actions (pull_request) Successful in 54s
Aikido Security PR Check / Aikido Security Scan (pull_request) Successful in 1m5s
feat: add cache action
Co-authored-by: Copilot <copilot@github.com>
2026-05-05 06:04:14 +00:00

54 lines
2 KiB
YAML

name: Schmalz Cache
description: >
Composite wrapper around actions/cache pinned to a specific commit SHA
to prevent supply chain attacks via tag or branch hijacking.
inputs:
path:
description: A list of files, directories, and wildcard patterns to cache and restore.
required: true
key:
description: An explicit key for saving and restoring the cache.
required: true
restore-keys:
description: An ordered multiline string listing prefix-matched keys used for restoring stale cache if no cache hit occurred for key.
required: false
default: ''
upload-chunk-size:
description: The chunk size used to split up large files during upload, in bytes.
required: false
default: ''
enableCrossOsArchive:
description: When enabled, allows Windows runners to save or restore caches that can be used on other platforms.
required: false
default: 'false'
fail-on-cache-miss:
description: Fail the workflow if cache entry is not found.
required: false
default: 'false'
lookup-only:
description: Check if a cache entry exists for the given input(s) without downloading the cache.
required: false
default: 'false'
outputs:
cache-hit:
description: A boolean value to indicate an exact match was found for the primary key.
value: ${{ steps.cache.outputs.cache-hit }}
runs:
using: composite
steps:
# Pinned to commit SHA instead of a tag to prevent supply chain attacks.
# actions/cache v4.3.0 — https://code.forgejo.org/actions/cache/commits/tag/v4.3.0
- name: Cache
id: cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: ${{ inputs.path }}
key: ${{ inputs.key }}
restore-keys: ${{ inputs.restore-keys }}
upload-chunk-size: ${{ inputs.upload-chunk-size }}
enableCrossOsArchive: ${{ inputs.enableCrossOsArchive }}
fail-on-cache-miss: ${{ inputs.fail-on-cache-miss }}
lookup-only: ${{ inputs.lookup-only }}