Last active
April 15, 2025 09:29
-
-
Save guilbep/fb40c3866ea1b6ff5609bf4854b1f39a to your computer and use it in GitHub Desktop.
automatic push to gitlab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Mirror to GitLab | |
on: | |
push: | |
branches: | |
- '**' # Trigger on push to any branch | |
jobs: | |
mirror: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Need full history for mirroring | |
- name: Push to GitLab mirror | |
env: | |
GITLAB_USERNAME: ${{ secrets.GITLAB_USERNAME }} | |
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} | |
GITLAB_URL: ${{ secrets.GITLAB_URL }} # e.g., 'gitlab.com' or your self-hosted GitLab URL | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
run: | | |
echo "Setting up GitLab remote..." | |
git remote add gitlab https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${GITLAB_URL}/${GITHUB_REPOSITORY}.git | |
echo "Pushing to GitLab mirror..." | |
git push gitlab --mirror --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment