优化同步工作流 (#5036)

This commit is contained in:
neveler
2025-12-21 16:25:45 +08:00
committed by GitHub
parent d3d46f6a29
commit ebad1f67ce

View File

@@ -11,8 +11,9 @@ concurrency:
jobs: jobs:
mirror: mirror:
strategy: strategy:
fail-fast: false
matrix: matrix:
target: include:
- name: Gitee - name: Gitee
repo: gitee.com/huanghongxun/HMCL repo: gitee.com/huanghongxun/HMCL
user: 'hmcl-sync' user: 'hmcl-sync'
@@ -21,12 +22,12 @@ jobs:
repo: cnb.cool/HMCL-dev/HMCL repo: cnb.cool/HMCL-dev/HMCL
user: 'cnb' user: 'cnb'
token: 'CNB_SYNC_TOKEN' token: 'CNB_SYNC_TOKEN'
name: Mirror to ${{ matrix.target.name }} name: Mirror to ${{ matrix.name }}
if: ${{ github.repository == 'HMCL-dev/HMCL' }} if: ${{ github.repository == 'HMCL-dev/HMCL' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Mirror GitHub to ${{ matrix.target.name }} - name: Mirror GitHub to ${{ matrix.name }}
run: | run: |
git clone --mirror "https://github.com/$GITHUB_REPOSITORY.git" -- repo git clone --mirror "https://github.com/${{ github.repository }}.git" -- repo
cd repo cd repo
git push -f --prune "https://${{ matrix.target.user }}:${{ secrets[matrix.target.token] }}@${{ matrix.target.repo }}.git" "refs/heads/*:refs/heads/*" "refs/tags/*:refs/tags/*" git push -f --prune "https://${{ matrix.user }}:${{ secrets[matrix.token] }}@${{ matrix.repo }}.git" "refs/heads/*:refs/heads/*" "refs/tags/*:refs/tags/*"