Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions .github/actions/install-prek/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,34 +67,35 @@ runs:
key: cache-prek-v9-${{ inputs.platform }}-python${{ inputs.python-version }}-uv${{ inputs.uv-version }}-${{ hashFiles('**/.pre-commit-config.yaml') }}
path: /tmp/
id: restore-prek-cache
- name: "Check if prek cache tarball exists"
- name: "Restore .cache from the tar file"
id: restore-prek-tar
shell: bash
run: |
if [ -f /tmp/cache-prek.tar.gz ]; then
echo "✅ Cache tarball found: /tmp/cache-prek.tar.gz"
else
if [ ! -f /tmp/cache-prek.tar.gz ]; then
echo "❌ Cache tarball missing. Expected /tmp/cache-prek.tar.gz"
exit 1
echo "tar-restored=false" >> "${GITHUB_OUTPUT}"
exit 0
fi
echo "✅ Cache tarball found: /tmp/cache-prek.tar.gz"
if tar -C ~ -xzf /tmp/cache-prek.tar.gz; then
echo "✅ Cache tarball extracted successfully"
echo "tar-restored=true" >> "${GITHUB_OUTPUT}"
echo "Restored files"
du ~/ --max-depth=2
echo
else
echo "⚠️ Cache tarball extraction failed — treating as cache miss"
echo "tar-restored=false" >> "${GITHUB_OUTPUT}"
rm -rf ~/.cache/prek
fi
if: steps.restore-prek-cache.outputs.stash-hit == 'true'
- name: "Restore .cache from the tar file"
run: tar -C ~ -xzf /tmp/cache-prek.tar.gz
shell: bash
if: steps.restore-prek-cache.outputs.stash-hit == 'true'
- name: "Show restored files"
run: |
echo "Restored files"
du ~/ --max-depth=2
echo
shell: bash
if: steps.restore-prek-cache.outputs.stash-hit == 'true'
- name: "Make sure cache is cleared on cache miss"
run: |
echo "Cleaning up prek cache in case of cache miss (in case of pre-installed-cache from the system)"
ls -la ~/.cache/prek || true
rm -rf ~/.cache/prek
shell: bash
if: steps.restore-prek-cache.outputs.stash-hit != 'true'
if: steps.restore-prek-cache.outputs.stash-hit != 'true' || steps.restore-prek-tar.outputs.tar-restored != 'true'
- name: Install prek hooks
shell: bash
run: prek install-hooks
Expand Down
Loading