feat: 更新 test-cache-state 和 cache-state GitHub Action,修正缓存键格式验证逻辑,确保在不同运行环境下正确识别缓存键,同时增强输出信息以便于调试和监控缓存状态。

This commit is contained in:
Lyda
2025-08-21 12:22:22 +08:00
parent ef9d766ecb
commit 7f178d1e30
2 changed files with 11 additions and 6 deletions

View File

@@ -66,8 +66,8 @@ jobs:
exit 1
fi
# 验证缓存键格式
if [[ "${{ steps.basic-test.outputs.cache-key }}" =~ ^ubuntu-latest-.*-basic-test-.* ]]; then
# 验证缓存键格式runner.os 在 ubuntu 运行器上返回 "Linux"
if [[ "${{ steps.basic-test.outputs.cache-key }}" =~ ^Linux-.*-basic-test-.* ]]; then
echo "✅ 缓存键格式正确"
else
echo "❌ 缓存键格式不正确: ${{ steps.basic-test.outputs.cache-key }}"
@@ -364,7 +364,7 @@ jobs:
if [[ "${{ steps.short-expiry.outputs.cache-key }}" =~ -[0-9]+$ ]]; then
echo "✅ 缓存键包含时间窗口标识"
else
echo "❌ 缓存键缺少时间窗口标识"
echo "❌ 缓存键缺少时间窗口标识: ${{ steps.short-expiry.outputs.cache-key }}"
exit 1
fi
@@ -390,7 +390,7 @@ jobs:
if [[ ! "${{ steps.no-expiry.outputs.cache-key }}" =~ -[0-9]+$ ]]; then
echo "✅ 永不过期缓存键格式正确"
else
echo "❌ 永不过期缓存键不应包含时间窗口"
echo "❌ 永不过期缓存键不应包含时间窗口: ${{ steps.no-expiry.outputs.cache-key }}"
exit 1
fi