Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic sync with Gitlab's read-only mirror #75

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/sync-with-gitlab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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/metamod-r.git"
REPO_TARGET: "[email protected]:rehlds/metamod-r.git"
run: |
git clone --mirror "$REPO_ORIGINAL" repo-mirror
cd repo-mirror
git remote set-url origin "$REPO_TARGET"
git push --mirror --force