name: Sync to GitCode (Only on PR Merge to Main) on: pull_request: types: [closed] # 监听 PR 关闭事件 branches: [main] # 仅当目标分支是 main 时才触发 jobs: sync: if: github.event.pull_request.merged == true # 仅当 PR 被合并时运行 runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: ref: main # 检出 main 分支 fetch-depth: 0 # 获取完整历史 - name: Push to GitCode run: | git remote add gitcode https://qq_41605780:${{ secrets.GITCODE_TOKEN }}@gitcode.com/qq_41605780/zhenxun_bot.git git push gitcode HEAD:main --force-with-lease