-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (41 loc) · 1.25 KB
/
Copy pathgitlab-mirror.yml
File metadata and controls
47 lines (41 loc) · 1.25 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Mirror to GitLab
on:
push:
branches:
- "**"
tags:
- "**"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: gitlab-mirror
cancel-in-progress: false
jobs:
mirror:
if: github.repository == 'lostf1sh/PixelPlayerOSS'
runs-on: ubuntu-latest
steps:
- name: Configure GitLab SSH key
env:
SSH_PRIVATE_KEY: ${{ secrets.GITLAB_MIRROR_SSH_PRIVATE_KEY }}
shell: bash
run: |
set -euo pipefail
test -n "$SSH_PRIVATE_KEY"
mkdir -p ~/.ssh
chmod 700 ~/.ssh
printf '%s\n' "$SSH_PRIVATE_KEY" > ~/.ssh/gitlab_mirror
chmod 600 ~/.ssh/gitlab_mirror
ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
- name: Mirror heads and tags
env:
GIT_SSH_COMMAND: ssh -i ~/.ssh/gitlab_mirror -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes
shell: bash
run: |
set -euo pipefail
git clone --bare "https://github.com/${GITHUB_REPOSITORY}.git" repo.git
cd repo.git
git remote add gitlab git@gitlab.com:lostf1sh1/PixelPlayerOSS.git
git push --prune gitlab '+refs/heads/*:refs/heads/*'
git push --prune gitlab '+refs/tags/*:refs/tags/*'