Sync master to Gitee #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync master to Gitee | |
| on: | |
| # push: | |
| # branches: ["master"] # 仅在 master 分支变动时触发 | |
| workflow_dispatch: # 允许手动触发 | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout master | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: master # 明确拉取 master 分支 | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Push to Gitee | |
| env: | |
| GITEE_USER: ${{ secrets.GITEE_USER }} | |
| GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }} | |
| GITEE_REPO: ${{ secrets.GITEE_REPO || github.event.repository.name }} | |
| run: | | |
| git remote add gitee "https://${GITEE_USER}:${GITEE_TOKEN}@gitee.com/${GITEE_USER}/${GITEE_REPO}.git" | |
| git push -f gitee HEAD:master # 强制推送当前分支到 Gitee 的 master |