address code review: portable find, jq for JSON construction
Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/4d7b9c05-531f-4e93-a770-f9324c663c38
This commit is contained in:
parent
a10e020d26
commit
0f35d8bf90
|
|
@ -546,8 +546,16 @@ jobs:
|
|||
|
||||
# 写入部署状态文件
|
||||
TIMESTAMP=\$(date -u '+%Y-%m-%dT%H:%M:%SZ')
|
||||
printf '{\"last_deploy\":\"%s\",\"commit\":\"${{ github.sha }}\",\"modules_passed\":%d,\"modules_failed\":%d}' \
|
||||
\"\$TIMESTAMP\" \"\$PASSED\" \"\$FAILED\" > \"\$DP/data/deploy-status.json\" 2>/dev/null || true
|
||||
if command -v jq &>/dev/null; then
|
||||
jq -n --arg ts \"\$TIMESTAMP\" --arg commit \"${{ github.sha }}\" \
|
||||
--argjson passed \"\$PASSED\" --argjson failed \"\$FAILED\" \
|
||||
'{last_deploy: \$ts, commit: \$commit, modules_passed: \$passed, modules_failed: \$failed}' \
|
||||
> \"\$DP/data/deploy-status.json\" 2>/dev/null || true
|
||||
else
|
||||
printf '{\"last_deploy\":\"%s\",\"commit\":\"%s\",\"modules_passed\":%d,\"modules_failed\":%d}' \
|
||||
\"\$TIMESTAMP\" \"${{ github.sha }}\" \"\$PASSED\" \"\$FAILED\" \
|
||||
> \"\$DP/data/deploy-status.json\" 2>/dev/null || true
|
||||
fi
|
||||
"
|
||||
echo "✅ 冒烟测试完成"
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,8 @@ for dir in "$DEPLOY_PATH" /var/www/hololake-frontend /var/www/hololake; do
|
|||
echo "📂 $dir 最后修改时间:"
|
||||
stat -c '%y' "$dir" 2>/dev/null || stat -f '%Sm' "$dir" 2>/dev/null || echo "⚠️ 无法获取"
|
||||
echo "最新文件:"
|
||||
find "$dir" -type f -printf '%T@ %p\n' 2>/dev/null | sort -rn | head -5
|
||||
find "$dir" -type f -exec stat -c '%Y %n' {} \; 2>/dev/null | sort -rn | head -5 || \
|
||||
ls -lt "$dir" 2>/dev/null | head -6
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue