From e744d2a004c8d20f51567327e04f1069c147eea5 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Sun, 17 May 2026 02:03:11 +0800 Subject: [PATCH] Create restore-only action --- action.yaml | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/action.yaml b/action.yaml index e6d4dfb..bf234de 100644 --- a/action.yaml +++ b/action.yaml @@ -1,5 +1,5 @@ -name: 'Cache' -description: 'Cache build files as tar.xz on the runner filesystem' +name: 'Cache Restore' +description: 'Restore cache from tar.xz archive on the runner filesystem' inputs: path: description: 'Directory to cache' @@ -44,25 +44,3 @@ runs: echo "Cache miss: ${CACHE_KEY}" echo "cache-hit=false" >> $GITHUB_OUTPUT fi - - - name: Save cache - if: steps.restore.outputs.cache-hit != 'true' - shell: bash - run: | - CACHE_DIR="$HOME/.cache/.cache-store" - mkdir -p "$CACHE_DIR" - - KEY_HASH=$(sha256sum "${{ inputs.key-file }}" | awk '{print $1}') - CACHE_KEY="${{ inputs.key-prefix }}-${KEY_HASH}" - ARCHIVE="${CACHE_DIR}/${CACHE_KEY}.tar.xz" - - EXPANDED_PATH=$(eval echo "${{ inputs.path }}") - - if [ ! -d "$EXPANDED_PATH" ] || [ -z "$(ls -A "$EXPANDED_PATH" 2>/dev/null)" ]; then - echo "Cache directory empty, skipping save" - exit 0 - fi - - echo "Saving cache: ${CACHE_KEY}" - REL_PATH="$(echo "$EXPANDED_PATH" | sed 's|^/||')" - tar -cJf "$ARCHIVE" -C "/" "$REL_PATH" 2>/dev/null && echo "Cache saved" || echo "Cache save failed"