This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new 7bb0507beb8 [v3-1-test] Make prek cache restoration resilient to
corrupted tarballs (#63684) (#63685)
7bb0507beb8 is described below
commit 7bb0507beb823af9abbd44fc379c54ffc39aeb9c
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Mar 16 01:28:30 2026 +0100
[v3-1-test] Make prek cache restoration resilient to corrupted tarballs
(#63684) (#63685)
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.
(cherry picked from commit 20486bbb9fa4caaa87afce291cf741785d81e32e)
Co-authored-by: Jarek Potiuk <[email protected]>
---
.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 266c91f2ee7..eb67a6a3df8 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