111
This commit is contained in:
xiaochou164 2025-06-03 15:16:51 +00:00
parent fc43e6816f
commit d238775b29
1 changed files with 37 additions and 0 deletions

37
.github/workflows/sync-from-gitea.yaml vendored Normal file
View File

@ -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