@@ -13,42 +13,60 @@ permissions: read-all
1313jobs :
1414 mirror-gitlab :
1515 runs-on : ubuntu-latest
16- if : ${{ vars.GITLAB_MIRROR_ENABLED == 'true' }}
1716 permissions :
1817 contents : read
18+ if : ${{ vars.GITLAB_MIRROR_ENABLED == 'true' }}
1919
2020 steps :
2121 - name : Checkout
2222 uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2323 with :
2424 fetch-depth : 0
2525
26+ - name : Setup SSH
27+ uses : webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
28+ with :
29+ ssh-private-key : ${{ secrets.GITLAB_SSH_KEY }}
30+
31+ - name : Add GitLab to known hosts
32+ run : |
33+ mkdir -p ~/.ssh
34+ ssh-keyscan -t ed25519 gitlab.com >> ~/.ssh/known_hosts
35+
2636 - name : Push to GitLab
2737 env :
28- GITLAB_TOKEN : ${{ secrets.GITLAB_TOKEN }}
2938 REPO_NAME : ${{ github.event.repository.name }}
3039 run : |
31- git remote add gitlab https://oauth2:${GITLAB_TOKEN} @gitlab.com/ hyperpolymath/${REPO_NAME}.git || true
40+ git remote add gitlab git @gitlab.com: hyperpolymath/${REPO_NAME}.git || true
3241 git push gitlab HEAD:main --force || git push gitlab HEAD:master --force
3342 git push gitlab --tags --force
3443
3544 mirror-bitbucket :
3645 runs-on : ubuntu-latest
37- if : ${{ vars.BITBUCKET_MIRROR_ENABLED == 'true' }}
3846 permissions :
3947 contents : read
48+ if : ${{ vars.BITBUCKET_MIRROR_ENABLED == 'true' }}
4049
4150 steps :
4251 - name : Checkout
4352 uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4453 with :
4554 fetch-depth : 0
4655
56+ - name : Setup SSH
57+ uses : webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
58+ with :
59+ ssh-private-key : ${{ secrets.BITBUCKET_SSH_KEY }}
60+
61+ - name : Add Bitbucket to known hosts
62+ run : |
63+ mkdir -p ~/.ssh
64+ ssh-keyscan -t ed25519 bitbucket.org >> ~/.ssh/known_hosts
65+
4766 - name : Push to Bitbucket
4867 env :
49- BITBUCKET_TOKEN : ${{ secrets.BITBUCKET_TOKEN }}
5068 REPO_NAME : ${{ github.event.repository.name }}
5169 run : |
52- git remote add bitbucket https://x-token-auth:${BITBUCKET_TOKEN} @bitbucket.org/ hyperpolymath/${REPO_NAME}.git || true
70+ git remote add bitbucket git @bitbucket.org: hyperpolymath/${REPO_NAME}.git || true
5371 git push bitbucket HEAD:main --force || git push bitbucket HEAD:master --force
5472 git push bitbucket --tags --force
0 commit comments