fix(cd): restore gitea workflow yaml parsing
Some checks failed
CD Pipeline / tests (push) Failing after 2m20s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
Code Review / ai-code-review (push) Successful in 31s

This commit is contained in:
Your Name
2026-05-05 13:17:15 +08:00
parent f78b1b0690
commit b3d412f9eb

View File

@@ -287,12 +287,8 @@ jobs:
# 修法sed 去除奈秒 (.NNN...) 和末尾縮寫 (空格+大寫字母)GNU date 才能正確解析
CREATED_CLEAN=$(echo "$CREATED_AT" | sed 's/\.[0-9]*//' | sed 's/ [A-Z][A-Z]*$//')
CREATED_EPOCH=$(date -d "$CREATED_CLEAN" +%s 2>/dev/null || \
python3 -c "
import sys, datetime, re
ts = re.sub(r'\.\d+', '', sys.argv[1])
ts = re.sub(r'\s+[A-Z]{2,4}$', '', ts.strip())
print(int(datetime.datetime.strptime(ts, '%Y-%m-%d %H:%M:%S %z').timestamp()))
" "$CREATED_AT" 2>/dev/null || echo 0)
python3 -c "import sys, datetime, re; ts = re.sub(r'\\.\d+', '', sys.argv[1]); ts = re.sub(r'\\s+[A-Z]{2,4}$', '', ts.strip()); print(int(datetime.datetime.strptime(ts, '%Y-%m-%d %H:%M:%S %z').timestamp()))" \
"$CREATED_AT" 2>/dev/null || echo 0)
NOW_EPOCH=$(date +%s)
if [ "$CREATED_EPOCH" -gt 0 ] && \
[ $((NOW_EPOCH - CREATED_EPOCH)) -gt "$STALE_SECONDS" ]; then