增加同步地址

This commit is contained in:
2024-09-17 08:32:39 +08:00
parent c299b5833b
commit f25fd3142c
2 changed files with 7 additions and 4 deletions
+4 -2
View File
@@ -18,9 +18,11 @@ jobs:
- name: Push - name: Push
env: env:
TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
GITHUBUSER: ${{ secrets.GITHUBUSER }} GITHUBUSER: ${{ secrets.GITHUBUSER }}
GITCODETOKEN: ${{ secrets.GITCODETOKEN }}
GITCODEUSER: ${{ secrets.GITCODEUSER }}
run: | run: |
cd sync-gitee-to-github cd sync-gitee-to-github
python3 sync.py $GITHUBUSER $TOKEN python3 sync.py $GITHUBUSER $GITHUBTOKEN $GITCODEUSER $GITCODETOKEN
+3 -2
View File
@@ -9,7 +9,8 @@ dataHeaders = {
} }
pullUrl = "https://gitee.com/GXDE-OS/" pullUrl = "https://gitee.com/GXDE-OS/"
pushUrl = [ 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): if (len(sys.argv) < 1 + len(pushUrl) * 2):
@@ -52,7 +53,7 @@ for i in repoList:
# git remote set-url origin # git remote set-url origin
gitUrl = pushUrl[j].replace("@USER@", userName[j]).replace("@PASS@", password[j]) + "/" + i 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 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}'") os.system(f"rm -rf '{programPath}/git-clone/{i}'")