From f25fd3142cfe1b2abf5ce74b16a6e99b5807bc90 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Tue, 17 Sep 2024 08:32:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=8C=E6=AD=A5=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sync.yml | 6 ++++-- sync-gitee-to-github/sync.py | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 8de909c..9789750 100755 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -18,9 +18,11 @@ jobs: - name: Push env: - TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }} GITHUBUSER: ${{ secrets.GITHUBUSER }} + GITCODETOKEN: ${{ secrets.GITCODETOKEN }} + GITCODEUSER: ${{ secrets.GITCODEUSER }} run: | cd sync-gitee-to-github - python3 sync.py $GITHUBUSER $TOKEN + python3 sync.py $GITHUBUSER $GITHUBTOKEN $GITCODEUSER $GITCODETOKEN diff --git a/sync-gitee-to-github/sync.py b/sync-gitee-to-github/sync.py index ade4d0a..e9f900f 100644 --- a/sync-gitee-to-github/sync.py +++ b/sync-gitee-to-github/sync.py @@ -9,7 +9,8 @@ dataHeaders = { } pullUrl = "https://gitee.com/GXDE-OS/" pushUrl = [ - "https://@USER@:@PASS@@github.com/GXDE-OS/" + "https://@USER@:@PASS@@github.com/GXDE-OS/", + "https://@USER@:@PASS@@gitcode.com/GXDE-OS/" ] if (len(sys.argv) < 1 + len(pushUrl) * 2): @@ -52,7 +53,7 @@ for i in repoList: # git remote set-url origin gitUrl = pushUrl[j].replace("@USER@", userName[j]).replace("@PASS@", password[j]) + "/" + i os.system(f"cd '{programPath}/git-clone/{i}' ; git remote set-url origin '{gitUrl}'") - os.system(f"cd '{programPath}/git-clone/{i}' ; git push origin +'*'") + os.system(f"cd '{programPath}/git-clone/{i}' ; git push --mirror -f") # 移除临时文件 os.system(f"rm -rf '{programPath}/git-clone/{i}'")