You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.7 KiB
49 lines
1.7 KiB
name: "Restore dependency cache"
|
|
description: "Restore the dependency cache."
|
|
outputs:
|
|
cache-miss:
|
|
description: "Whether the cache was missed"
|
|
value: ${{ steps.check-cache.outputs.cache-miss }}
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Check dependency cache
|
|
id: dep-cache
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
|
|
key: ${{ env.DEPENDENCY_CACHE_KEY }}
|
|
|
|
- name: Retry cache restore on miss
|
|
id: dep-cache-retry
|
|
if: steps.dep-cache.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
run: |
|
|
echo "::warning::Cache miss detected, waiting 10 seconds and retrying..."
|
|
sleep 10
|
|
|
|
- name: Check dependency cache (retry)
|
|
id: dep-cache-retry-attempt
|
|
if: steps.dep-cache.outputs.cache-hit != 'true'
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
|
|
key: ${{ env.DEPENDENCY_CACHE_KEY }}
|
|
|
|
- name: Install dependencies on cache miss
|
|
if: steps.dep-cache.outputs.cache-hit != 'true' && steps.dep-cache-retry-attempt.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
run: |
|
|
echo "::warning::Dependency cache could not be restored after retry - installing dependencies from scratch"
|
|
yarn install --prefer-offline --frozen-lockfile
|
|
|
|
- name: Set cache miss output
|
|
id: check-cache
|
|
shell: bash
|
|
run: |
|
|
if [ "${{ steps.dep-cache.outputs.cache-hit }}" = "true" ] || [ "${{ steps.dep-cache-retry-attempt.outputs.cache-hit }}" = "true" ]; then
|
|
echo "cache-miss=false" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "cache-miss=true" >> $GITHUB_OUTPUT
|
|
fi |