Skip to content

mirror

mirror #2239

Workflow file for this run

name: mirror
on: [ push, delete, create ]
jobs:
gitee:
if: "github.repository_owner == 'swoole' && !contains(github.event.head_commit.message, '[test]')"
runs-on: ubuntu-latest
steps:
- name: Configure Private Key
env:
SSH_PRIVATE_KEY: ${{ secrets.GITEE_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "StrictHostKeyChecking no" >> ~/.ssh/config
- name: Push Mirror
env:
SOURCE_REPO: 'https://github.com/swoole/swoole-src.git'
DESTINATION_REPO: '[email protected]:swoole/swoole.git'
run: |
git clone --mirror "$SOURCE_REPO" && cd `basename "$SOURCE_REPO"`
git remote set-url --push origin "$DESTINATION_REPO"
git fetch -p origin
git for-each-ref --format 'delete %(refname)' refs/pull | git update-ref --stdin
git push --mirror