mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2026-06-16 20:24:51 +00:00
Include runner image metadata in cache key
This commit is contained in:
parent
3902329b61
commit
cccebf8faf
|
|
@ -46,7 +46,7 @@ There are three kinds of version labels you can use.
|
|||
|
||||
### Cache scopes
|
||||
|
||||
The cache is scoped to the packages given and the branch. The default branch cache is available to other branches.
|
||||
The cache is scoped to the packages given and the branch. The default branch cache is available to other branches. The cache key also includes runner image metadata (`ImageOS`, `ImageVersion`) when available so caches are invalidated as runner images change.
|
||||
|
||||
### Example workflow
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,17 @@ log "- CPU architecture is '${cpu_arch}'."
|
|||
|
||||
value="${packages} @ ${version} ${force_update_inc}"
|
||||
|
||||
# Include runner image metadata in cache key when available to avoid stale
|
||||
# cache hits when GitHub rotates images.
|
||||
if [ -n "${ImageOS}" ]; then
|
||||
value="${value} image_os:${ImageOS}"
|
||||
log "- Runner image OS '${ImageOS}' added to value."
|
||||
fi
|
||||
if [ -n "${ImageVersion}" ]; then
|
||||
value="${value} image_version:${ImageVersion}"
|
||||
log "- Runner image version '${ImageVersion}' added to value."
|
||||
fi
|
||||
|
||||
# Include repositories in cache key to ensure different repos get different caches
|
||||
if [ -n "${add_repository}" ]; then
|
||||
value="${value} ${add_repository}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue