Basic success

This commit is contained in:
shuaiplus
2026-02-03 22:56:42 +08:00
commit da307c79cd
27 changed files with 5639 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
# 自动同步上游更新
这个 GitHub Actions 工作流会自动将上游仓库(shuaiplus/nodewarden)的更新同步到你的 fork。
## 功能特性
- ✅ 每天自动检查并同步上游更新
- ✅ 支持手动触发同步
- ✅ 自动处理简单的合并
- ⚠️ 遇到冲突时会提醒你手动处理
## 如何启用
1. 在你 fork 的仓库中,进入 **Actions** 标签页
2. 点击 **I understand my workflows, go ahead and enable them**
3. 完成!工作流会自动运行
## 手动触发
1. 进入 **Actions** 标签页
2. 选择 **Sync Fork with Upstream**
3. 点击 **Run workflow****Run workflow**
## 注意事项
- 如果你修改了代码,可能会产生合并冲突
- 遇到冲突时,工作流会失败,需要你手动解决
- 建议不要修改核心代码,只修改配置文件
## 禁用自动同步
如果你不想自动同步:
1. 进入 **Actions** 标签页
2. 选择 **Sync Fork with Upstream**
3. 点击右上角的 **···** → **Disable workflow**
+60
View File
@@ -0,0 +1,60 @@
name: Sync Fork with Upstream
on:
schedule:
# Run every day at 2:00 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
# Allow manual trigger
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Sync with upstream
run: |
# Add upstream repository
git remote add upstream https://github.com/shuaiplus/nodewarden.git || true
# Fetch upstream changes
git fetch upstream
# Check if there are updates
BEHIND=$(git rev-list --count HEAD..upstream/main)
if [ "$BEHIND" -gt 0 ]; then
echo "Found $BEHIND commits behind upstream. Syncing..."
# Try to merge upstream/main into current branch
if git merge upstream/main --no-edit; then
echo "Merge successful!"
git push origin main
else
echo "Merge conflict detected. Please resolve manually."
echo "::warning::Failed to auto-sync due to merge conflicts. Manual intervention required."
exit 1
fi
else
echo "Already up to date with upstream."
fi
- name: Create summary
if: always()
run: |
echo "## Sync Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Upstream**: shuaiplus/nodewarden" >> $GITHUB_STEP_SUMMARY
echo "- **Branch**: main" >> $GITHUB_STEP_SUMMARY
echo "- **Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY