From 7daee7ca747772af1ac768a031d5dbfc308d87a2 Mon Sep 17 00:00:00 2001 From: iTrooz Date: Thu, 1 Jan 2026 16:18:04 +0100 Subject: [PATCH] ci: update workflow to manually download cache key (cherry picked from commit 892334e31add2a4b30d0d1bb4d62fa342573b1a7) --- .github/workflows/dl-cache.yml | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dl-cache.yml b/.github/workflows/dl-cache.yml index 7215c12c1..42f76e948 100644 --- a/.github/workflows/dl-cache.yml +++ b/.github/workflows/dl-cache.yml @@ -1,4 +1,6 @@ +# https://gist.github.com/iTrooz/d5bacca32c0974edc6c1ac3ad3ee82f3 # See https://github.com/cli/cli/issues/9125 +# Extract archive with `tar -xf cache.tzst --transform 's@\.\./@#@g' -P` to avoid ../ errors name: Download cache key on: @@ -8,22 +10,38 @@ on: description: 'Cache key' required: true type: string - jobs: - cache-upload: + cache-download: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - name: Cache dependencies - uses: actions/cache@v4 + - name: Query cache version + id: version + env: + GH_TOKEN: ${{ github.token }} + run: | + VERSION=$(gh api repos/$GITHUB_REPOSITORY/actions/caches \ + --jq " + .actions_caches[] + | select(.ref == \"refs/heads/$GITHUB_REF_NAME\") + | select(.key == \"${{ github.event.inputs.cache_key }}\") + | .version + ") + echo "version=$VERSION" | tee $GITHUB_OUTPUT + + - name: Restore cache + uses: iTrooz/cache/restore@restore_with_version with: - path: ./cache-folder + # Path won't be actually used, we will match by 'version'. + path: . key: ${{ github.event.inputs.cache_key }} + version: ${{ steps.version.outputs.version }} - name: Upload cached folder as artifact uses: actions/upload-artifact@v4 with: name: cache-artifact - path: ./cache-folder \ No newline at end of file + path: | + /home/runner/work/**/*.tzst \ No newline at end of file