From d238775b295ffc5ea33812b4a401881d2fa04de8 Mon Sep 17 00:00:00 2001 From: xiaochou164 Date: Tue, 3 Jun 2025 15:16:51 +0000 Subject: [PATCH] 11 111 --- .github/workflows/sync-from-gitea.yaml | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/sync-from-gitea.yaml diff --git a/.github/workflows/sync-from-gitea.yaml b/.github/workflows/sync-from-gitea.yaml new file mode 100644 index 0000000..3358678 --- /dev/null +++ b/.github/workflows/sync-from-gitea.yaml @@ -0,0 +1,37 @@ +name: Sync Gitea to GitHub (HTTPS) + +on: + schedule: + - cron: '*/10 * * * *' # 每 10 分钟执行一次 + workflow_dispatch: + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: Checkout GitHub repo + uses: actions/checkout@v3 + with: + ref: main # 你要同步的分支 + + - name: Set up Git + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + + - name: Add Gitea as remote (HTTPS) + run: | + # 添加 Gitea 为远程仓库,使用 HTTPS + git remote add gitea https://${{ secrets.GITEA_USER }}:${{ secrets.GITEA_PASSWORD }}@git.sundays.ink/xiaochou164/clash_rule.git + + - name: Fetch from Gitea + run: git fetch gitea + + - name: Reset to Gitea's main branch + run: git reset --hard gitea/main + + - name: Push to GitHub + run: | + # 替换为你的 GitHub 用户名和仓库名 + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_ACCESS_TOKEN }}@github.com/xiaochou164/clash_rule.git + git push origin main --force \ No newline at end of file