test cache fetch workflow #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check GHA cache | |
| on: push | |
| jobs: | |
| check-cache: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate random data | |
| run: | | |
| GHA_CACHE_DIR="$(mktemp -d)" | |
| echo GHA_CACHE_DIR="$GHA_CACHE_DIR" >> "$GITHUB_ENV" | |
| dd if=/dev/urandom of="$GHA_CACHE_DIR/data" bs=1024 count=1 | |
| - name: Store cache entry | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: ${{ env.GHA_CACHE_DIR }} | |
| key: 'gha-cache-check' | |
| - name: Verify cache entry | |
| id: verify | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: ${{ env.GHA_CACHE_DIR }} | |
| key: 'gha-cache-check' | |
| - name: Fail on cache miss | |
| if: steps.verify.outputs.cache-hit != 'true' | |
| run: exit 1 |