action.yml raw

   1  name: 'Cache Restore'
   2  description: 'Restore a cache with WarpBuild on Warp runners and GitHub Actions cache otherwise'
   3  inputs:
   4    path:
   5      description: 'A list of files, directories, and wildcard patterns to restore'
   6      required: true
   7    key:
   8      description: 'An explicit key for restoring the cache'
   9      required: true
  10    restore-keys:
  11      description: 'An ordered multiline string listing prefix-matched restore keys'
  12      required: false
  13      default: ''
  14    provider:
  15      description: 'The cache provider to use'
  16      required: true
  17  outputs:
  18    cache-hit:
  19      description: 'A boolean value to indicate an exact match was found for the primary key'
  20      value: ${{ steps.warp.outputs.cache-hit || steps.gha.outputs.cache-hit }}
  21    cache-primary-key:
  22      description: 'The primary key used to restore the cache'
  23      value: ${{ steps.warp.outputs.cache-primary-key || steps.gha.outputs.cache-primary-key }}
  24  runs:
  25    using: 'composite'
  26    steps:
  27      - name: Restore cache with WarpBuild
  28        id: warp
  29        if: ${{ inputs.provider == 'warp' }}
  30        uses: WarpBuilds/cache/restore@v1
  31        with:
  32          path: ${{ inputs.path }}
  33          key: ${{ inputs.key }}
  34          restore-keys: ${{ inputs.restore-keys }}
  35  
  36      - name: Restore cache with GitHub Actions
  37        id: gha
  38        if: ${{ inputs.provider == 'gha' }}
  39        uses: actions/cache/restore@v5
  40        with:
  41          path: ${{ inputs.path }}
  42          key: ${{ inputs.key }}
  43          restore-keys: ${{ inputs.restore-keys }}
  44