From f8d1a6f2b4d26c417558bb77ed134d9600bd85c0 Mon Sep 17 00:00:00 2001 From: Nicholas Dudfield Date: Thu, 30 Oct 2025 13:25:55 +0700 Subject: [PATCH] fix: normalize paths in cache actions to fix bootstrap detection Path comparison was failing when registry had expanded paths (/home/runner/.ccache) but input had unexpanded paths (~/.ccache), causing bootstrap mode to not be detected. Now both restore and save actions consistently expand tildes to absolute paths before writing to or reading from the mount registry. --- .github/actions/xahau-actions-cache-restore/action.yml | 8 ++++++++ .github/actions/xahau-actions-cache-save/action.yml | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/.github/actions/xahau-actions-cache-restore/action.yml b/.github/actions/xahau-actions-cache-restore/action.yml index 908e187c2..7c1497ecf 100644 --- a/.github/actions/xahau-actions-cache-restore/action.yml +++ b/.github/actions/xahau-actions-cache-restore/action.yml @@ -81,6 +81,14 @@ runs: echo "Use deltas: ${USE_DELTAS}" echo "" + # Normalize target path (expand tilde and resolve to absolute path) + # This ensures consistent path comparison in the mount registry + if [[ "${TARGET_PATH}" == ~* ]]; then + # Expand tilde manually (works even if directory doesn't exist yet) + TARGET_PATH="${HOME}${TARGET_PATH:1}" + fi + echo "Normalized target path: ${TARGET_PATH}" + # Generate unique cache workspace CACHE_HASH=$(echo "${CACHE_KEY}" | md5sum | cut -d' ' -f1) CACHE_WORKSPACE="/tmp/xahau-cache-${CACHE_HASH}" diff --git a/.github/actions/xahau-actions-cache-save/action.yml b/.github/actions/xahau-actions-cache-save/action.yml index 35a8f09d5..e6573ffec 100644 --- a/.github/actions/xahau-actions-cache-save/action.yml +++ b/.github/actions/xahau-actions-cache-save/action.yml @@ -52,6 +52,15 @@ runs: echo "S3 bucket: s3://${S3_BUCKET}" echo "" + # Normalize target path (expand tilde and resolve to absolute path) + # This ensures consistent path comparison with the mount registry + if [[ "${TARGET_PATH}" == ~* ]]; then + # Expand tilde manually (works even if directory doesn't exist yet) + TARGET_PATH="${HOME}${TARGET_PATH:1}" + fi + echo "Normalized target path: ${TARGET_PATH}" + echo "" + # Find the cache workspace from mount registry MOUNT_REGISTRY="/tmp/xahau-cache-mounts.txt"