name: Restore build cache
description: Composite action that restores a build cache and reports whether it hit.
author: Novus Examples

inputs:
  key-prefix:
    description: Prefix for the cache key
    required: false
    default: build
  path:
    description: Directory to cache
    required: true

outputs:
  cache-hit:
    description: "true when the cache was restored"
    value: ${{ steps.probe.outputs.hit }}

runs:
  using: composite
  steps:
    - id: probe
      shell: bash
      run: echo "hit=false" >> "$GITHUB_OUTPUT"
    - shell: bash
      run: echo "restoring ${{ inputs.path }} for ${{ inputs.key-prefix }}"

branding:
  icon: archive
  color: blue
