This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 20486bbb9fa Make prek cache restoration resilient to corrupted
tarballs (#63684)
20486bbb9fa is described below
commit 20486bbb9fa4caaa87afce291cf741785d81e32e
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Mar 16 00:14:57 2026 +0100
Make prek cache restoration resilient to corrupted tarballs (#63684)
Previously, a missing or corrupted cache tarball would hard-fail the
entire static checks job even when stash-hit reported true. Now the
extraction is wrapped in error handling: if the tarball is missing or
tar fails, it gracefully falls through to a clean prek install-hooks
instead of aborting.
---
.github/actions/install-prek/action.yml | 35 +++++++++++++++++----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/.github/actions/install-prek/action.yml
b/.github/actions/install-prek/action.yml
index 34991abf551..f02f91d7f01 100644
--- a/.github/actions/install-prek/action.yml
+++ b/.github/actions/install-prek/action.yml
@@ -67,26 +67,27 @@ 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: |
@@ -94,7 +95,7 @@ runs:
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