添加 GitHub 同步脚本与定时任务

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-11 19:23:04 +08:00
parent c4b15ac242
commit 12905e90cf
3 changed files with 66 additions and 0 deletions

23
scripts/push-to-github.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# 卡若AI · 本地 → GitHub 同步(路径:个人/卡若AI
# 用法:./scripts/push-to-github.sh [提交说明]
set -e
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO_ROOT"
if ! git remote get-url origin &>/dev/null; then
echo "未配置 origin。请执行: git remote add origin <仓库URL>"
exit 1
fi
if git diff --quiet && git diff --cached --quiet && [[ -z $(git status -s) ]]; then
echo "[$(date '+%Y-%m-%d %H:%M')] 无变更,跳过推送。"
exit 0
fi
git add -A
msg="${1:-同步卡若AI$(date '+%Y-%m-%d %H:%M')}"
git commit -m "$msg" || true
git push origin HEAD
echo "[$(date '+%Y-%m-%d %H:%M')] 已推送到 GitHub。"