From f61f86f8feb126393c11fe4f1fad15e00e9fa032 Mon Sep 17 00:00:00 2001 From: Ke Sun Date: Thu, 2 Apr 2026 10:43:06 +0800 Subject: [PATCH 1/3] ci: add GitHub Actions workflow to sync branches to Gitee - Add new GitHub Actions workflow file for syncing all branches to Gitee repository - Configure workflow to trigger on push events to any branch - Implement branch synchronization logic using git remote and force push - Add .claude to .gitignore to exclude IDE-specific files - Enable automated repository mirroring between GitHub and Gitee platforms --- .github/workflow/.sync-to-gitee.yml | 35 +++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 36 insertions(+) create mode 100644 .github/workflow/.sync-to-gitee.yml diff --git a/.github/workflow/.sync-to-gitee.yml b/.github/workflow/.sync-to-gitee.yml new file mode 100644 index 00000000..00daffce --- /dev/null +++ b/.github/workflow/.sync-to-gitee.yml @@ -0,0 +1,35 @@ +name: Sync All Branches to Gitee + +on: + push: + branches: + - '*' + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout Source Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Sync All Branches + run: | + # 1. 配置 Git 用户信息 + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + + # 2. 构建带 Token 的 HTTPS 远程地址 + GITEE_URL="https://${{ secrets.GITEE_USERNAME }}:${{ secrets.GITEE_TOKEN }}@gitee.com/${{ secrets.GITEE_USERNAME }}/test-push-gitee.git" + + # 3. 添加远程仓库 (命名为 gitee) + git remote add gitee $GITEE_URL + + # 4. 遍历并推送所有分支 + # 这一步会获取本地所有分支名,并依次推送到 Gitee + for branch in $(git branch -r | grep -v HEAD | sed 's/origin\///'); do + echo "Syncing branch: $branch" + git push -f gitee $branch:$branch + done \ No newline at end of file diff --git a/.gitignore b/.gitignore index ae3261f0..0ec6822c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ examples/ .kiro .vscode .idea +.claude # Temporary outputs .DS_Store From 370a668ead8568f7df06cbdc7a48d7f7a39685c5 Mon Sep 17 00:00:00 2001 From: Ke Sun Date: Thu, 2 Apr 2026 10:46:30 +0800 Subject: [PATCH 2/3] ci: move sync-to-gitee workflow to correct directory - Move .sync-to-gitee.yml from .github/workflow/ to .github/workflows/ - Fix workflow file location to match GitHub Actions standard directory structure - Ensure workflow is properly recognized and executed by GitHub Actions --- .github/{workflow => workflows}/.sync-to-gitee.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{workflow => workflows}/.sync-to-gitee.yml (100%) diff --git a/.github/workflow/.sync-to-gitee.yml b/.github/workflows/.sync-to-gitee.yml similarity index 100% rename from .github/workflow/.sync-to-gitee.yml rename to .github/workflows/.sync-to-gitee.yml From 4fb3d6992cb962234e0716c88d3ee5ec4b2165fe Mon Sep 17 00:00:00 2001 From: Ke Sun Date: Thu, 2 Apr 2026 10:49:31 +0800 Subject: [PATCH 3/3] ci: update Gitee sync workflow repository name - Change target repository from test-push-gitee to MemoryBear - Update GITEE_URL variable to point to correct Gitee repository - Ensure workflow syncs to the proper upstream repository --- .github/workflows/.sync-to-gitee.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/.sync-to-gitee.yml b/.github/workflows/.sync-to-gitee.yml index 00daffce..b8b39c90 100644 --- a/.github/workflows/.sync-to-gitee.yml +++ b/.github/workflows/.sync-to-gitee.yml @@ -22,7 +22,7 @@ jobs: git config --global user.email "actions@github.com" # 2. 构建带 Token 的 HTTPS 远程地址 - GITEE_URL="https://${{ secrets.GITEE_USERNAME }}:${{ secrets.GITEE_TOKEN }}@gitee.com/${{ secrets.GITEE_USERNAME }}/test-push-gitee.git" + GITEE_URL="https://${{ secrets.GITEE_USERNAME }}:${{ secrets.GITEE_TOKEN }}@gitee.com/${{ secrets.GITEE_USERNAME }}/MemoryBear.git" # 3. 添加远程仓库 (命名为 gitee) git remote add gitee $GITEE_URL