Touch archives on hit and prune the cache store after restore
Record last use by touching the archive so the retention policy can expire by access time, and run prune.sh after every restore (even on miss) to keep the shared store trimmed: keep the 3 newest archives per key-prefix family, expire anything older than 7 days, hard-cap the store at 2 GB (oldest first, trumping the keep set), never touch files younger than 1h, and drop stale run workspaces under ~/.cache/act older than 2 days.
This commit is contained in:
+11
-2
@@ -40,9 +40,18 @@ runs:
|
||||
if [ -f "$ARCHIVE" ]; then
|
||||
echo "Cache hit: ${CACHE_KEY}"
|
||||
mkdir -p "$EXPANDED_PATH"
|
||||
tar -xf "$ARCHIVE" -C "/" 2>/dev/null || true
|
||||
echo "cache-hit=true" >> $GITHUB_OUTPUT
|
||||
if tar -xf "$ARCHIVE" -C "/" 2>/dev/null; then
|
||||
# record last use so the retention policy can expire by access time
|
||||
touch "$ARCHIVE"
|
||||
echo "cache-hit=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Cache restore failed"
|
||||
echo "cache-hit=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
else
|
||||
echo "Cache miss: ${CACHE_KEY}"
|
||||
echo "cache-hit=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
# Trim the shared cache store and stale workspaces (best-effort)
|
||||
bash "${{ github.action_path }}/prune.sh" || true
|
||||
|
||||
Reference in New Issue
Block a user