forked from rehlds/ReHLDS
-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (26 loc) · 957 Bytes
/
sync-with-gitlab.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
name: Automatic sync with Gitlab's read-only mirror
on: [workflow_dispatch, push]
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up SSH key for Runner
env:
SSH_KEY: ${{ secrets.GITLAB_DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts
- name: Clone repository from GitHub as mirror and push to Gitlab
env:
REPO_ORIGINAL: "https://github.com/rehlds/rehlds.git"
REPO_TARGET: "[email protected]:rehlds/rehlds.git"
run: |
git clone --mirror "$REPO_ORIGINAL" repo-mirror
cd repo-mirror
git remote set-url origin "$REPO_TARGET"
git push --mirror --force