From ee385717a33160eb303cba77062cc85d310f096b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=BA=E6=A2=B0=E5=B0=8F=E9=B8=BD?= <128568434+jixiexiaoge@users.noreply.github.com> Date: Sun, 22 Jun 2025 17:45:30 +0800 Subject: [PATCH] Update push2gitee.yml --- .github/workflows/push2gitee.yml | 33 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/push2gitee.yml b/.github/workflows/push2gitee.yml index 0f7afb4..3a231b1 100644 --- a/.github/workflows/push2gitee.yml +++ b/.github/workflows/push2gitee.yml @@ -1,8 +1,8 @@ -name: Sync to Private Gitee +name: Daily Sync to Gitee on: schedule: - - cron: '0 1 * * *' # 每天 UTC 1 点(北京时间 9 点) + - cron: '0 2 * * *' # 每天UTC时间2点执行(北京时间10点) workflow_dispatch: # 支持手动触发 jobs: @@ -10,21 +10,24 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout GitHub repository (full history) - uses: actions/checkout@v3 - with: - fetch-depth: 0 # ⬅️ 关键修改,避免 shallow clone 错误 + - name: Checkout this repository + uses: actions/checkout@v4 - - name: Set Git config + - name: Configure Git run: | - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" + git config --global user.name "github-actions" + git config --global user.email "github-actions@github.com" - - name: Add Gitee remote + - name: Add Gitee remote and force push + env: + GITEE_USERNAME: zhudongjer + GITEE_TOKEN: 11f606dc48ee2c481918e169b2291fb3c4705cdf run: | - git remote add gitee http://${{ secrets.GITEE_USERNAME }}:${{ secrets.GITEE_TOKEN }}@49.235.152.15:3000/zhudongjer/carrot.git + # 添加 Gitee 远程地址(HTTP + Token) + git remote add gitee http://$GITEE_USERNAME:$GITEE_TOKEN@49.235.152.15:3000/$GITEE_USERNAME/carrot.git - - name: Force push to Gitee - run: | - git push gitee --force --all - git push gitee --force --tags + # 强制推送当前分支(假设为 master) + git push gitee master --force + + # 推送标签(如果有) + git push gitee --tags