automatically push GitHub commits to GitLab instance

Add a .github/workflows/main.yml file in your repository:

---
name: Mirror Repository

on:
  push:
    branches:
      - master

permissions:
  contents: read

jobs:
  gitlab:
    runs-on: ubuntu-latest
    steps:
      - name: Update CA certificates
        run: | 
            sudo apt-get update && sudo apt-get install -y ca-certificates
            sudo update-ca-certificates
            git config --global http.sslVerify false
            
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0 # This must be set to 0 to avoid shallow cloning.

      - name: Mirror Repository
        uses: nickmcummins/github-action-gitlab-mirror@v1.0.1
        with:
          password: ${{ secrets.GITLAB_PAT }}
          repository_url: https://gitlab.com/forks/archlinux-pkgbuilds.git
          username: username@linuxmail.orgCode language: JavaScript (javascript)

Define GITLAB_PAT in the Settings of your GitHub repository:

Leave a Reply