CI: key the package caches on the runner image

ImageOS and ImageVersion are the runner's environment variables, not the
workflow's env context, so ${{ env.ImageVersion }} was empty and the
cache key never changed with the image. Build the key in the shell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUAp3wTZAV7UCEiC4S
This commit is contained in:
Claude committed 2026-11-01 01:25:23 +00:00
1 parent f6a9362344
commit 43a67aaa4e
1 file changed
+3 -2
+3 -2
View File
@@ -30,13 +30,14 @@ runs:
run: |
pkgs=$(printf '%s\n' $PKGS | sort -u | tr '\n' ' ')
echo "pkgs=$pkgs" >> "$GITHUB_OUTPUT"
echo "hash=$(printf '%s|%s|%s' "$pkgs" "$PPA" "$REC" | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT"
# (ImageOS, ImageVersion: the runner's environment, not the env context)
echo "key=apt-${ImageOS:-none}-$RUNNER_ARCH-${ImageVersion:-none}-$(printf '%s|%s|%s' "$pkgs" "$PPA" "$REC" | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT"
- id: restore
uses: actions/cache/restore@v4
with:
path: /tmp/apt-cache
key: apt-${{ env.ImageOS }}-${{ runner.arch }}-${{ env.ImageVersion }}-${{ steps.key.outputs.hash }}
key: ${{ steps.key.outputs.key }}
- id: install
shell: bash