gitee-sync #42
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: gitee-sync | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| sync: | |
| name: gitee-sync | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| if: github.actor != 'dependabot[bot]' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Configure SSH key for Gitee | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| with: | |
| ssh-private-key: ${{ secrets.GITEE_PI_SSH }} | |
| - name: Verify Gitee SSH connectivity | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p ~/.ssh | |
| ssh-keyscan -H gitee.com >> ~/.ssh/known_hosts | |
| ssh -o BatchMode=yes -T git@gitee.com || true | |
| git ls-remote git@gitee.com:agoraio-community/API-Examples.git HEAD | |
| - name: Mirror repo to Gitee | |
| shell: bash | |
| env: | |
| GIT_TRACE: 1 | |
| GIT_TRACE_PACKET: 1 | |
| run: | | |
| set -euo pipefail | |
| git remote add gitee git@gitee.com:agoraio-community/API-Examples.git || \ | |
| git remote set-url gitee git@gitee.com:agoraio-community/API-Examples.git | |
| git push --progress -f gitee HEAD:main |