#!/bin/bash
cd /root/.openclaw/workspace
# 拉取最新代码避免冲突
git pull origin master
# 添加所有文件（除了.gitignore里的secrets.md）
git add .
# 提交
git commit -m "daily backup $(date +'%Y-%m-%d %H:%M:%S')"
# 推送
git push origin master
# 检查是否成功
if [ $? -eq 0 ]; then
    echo "✅ Workspace backup success $(date +'%Y-%m-%d')"
else
    echo "❌ Workspace backup failed $(date +'%Y-%m-%d')"
fi
