Skip to content

Commit ebd7332

Browse files
committed
sd
1 parent 70e681f commit ebd7332

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

update-notes.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ fi
4242

4343
echo "✅ PDF 已输出到: $OUT_FILE"
4444

45+
# === 避免 10 分钟内重复 push ===
46+
TIMESTAMP_FILE=".last_push_time"
47+
48+
if [ -f "$TIMESTAMP_FILE" ]; then
49+
LAST_PUSH=$(cat "$TIMESTAMP_FILE")
50+
else
51+
LAST_PUSH=0
52+
fi
53+
54+
NOW=$(date +%s)
55+
DIFF=$(( NOW - LAST_PUSH ))
56+
57+
if [ $DIFF -lt 600 ]; then
58+
echo "⏳ 上次 push 距离现在仅 $DIFF 秒 (<600 秒),跳过 push。"
59+
git add "$TYP_FILE" "$OUT_FILE"
60+
git commit -m "$COMMIT_MSG" >/dev/null 2>&1
61+
exit 0
62+
fi
63+
64+
4565
# === Git 操作 ===
4666
echo "📦 执行 git add/commit/push"
4767

@@ -55,7 +75,7 @@ fi
5575

5676
git push
5777
if [ $? -eq 0 ]; then
78+
echo "$NOW" > "$TIMESTAMP_FILE"
5879
echo "✅ Push 完成!GitHub Pages 将自动部署。"
5980
else
6081
echo "❌ Push 失败,请检查网络或权限。"
61-
fi

0 commit comments

Comments
 (0)