-
-
Notifications
You must be signed in to change notification settings - Fork 169
34 lines (31 loc) · 1019 Bytes
/
mirror.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: mirror
on:
push:
delete:
create:
release:
types: [published]
jobs:
gitee:
if: github.repository == 'imiphp/imi' && (github.ref == 'refs/heads/3.0')
runs-on: ubuntu-20.04
steps:
- uses: ahmadnassri/action-workflow-queue@v1
- 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/imiphp/imi.git"
DESTINATION_REPO: "[email protected]:yurunsoft/IMI.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