name: Cache
description: Caches build data to speed builds
inputs:
  key:
    description: 'extra cache key components'
    required: false
    default: ''


runs:
  using: "composite"

  steps:
    - name: Normalize key
      id: normalized-key
      run: echo "key=$(echo "${KEY}" | tr -d ',')" >> $GITHUB_OUTPUT
      shell: bash
      env:
        KEY: "${{ inputs.key }}"
    - uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0  # v2.8.0
      with:
        key: ${{ steps.normalized-key.outputs.key }}-4
