name: Cache Pods

description: Cache CocoaPods dependencies.

inputs:
  path:
    description: Paths to cache
    required: false
    default: |
      ios/Pods
      ~/Library/Caches/CocoaPods
  lockfile:
    description: Path to Podfile.lock
    required: false
    default: ios/Podfile.lock
  cache-version:
    description: Additional cache version segment
    required: false
    default: v1

outputs:
  cache-hit:
    description: Whether an exact match was found for the cache key
    value: ${{ steps.cache.outputs.cache-hit }}

runs:
  using: "composite"
  steps:
    - id: cache
      name: Cache Pods
      uses: actions/cache@v4
      with:
        path: ${{ inputs.path }}
        key: ${{ runner.os }}-pods-${{ inputs.cache-version }}-${{ hashFiles(inputs.lockfile) }}
        restore-keys: |
          ${{ runner.os }}-pods-${{ inputs.cache-version }}-
          ${{ runner.os }}-pods-
