From e25b521cff4ae9073d2d1d0959fc489e48063c57 Mon Sep 17 00:00:00 2001
From: Jorge Echevarria Uribarri
 <jorge.echevarriauribarri.practicas@telefonica.com>
Date: Mon, 2 Dec 2024 10:12:16 +0100
Subject: [PATCH] Create gitlab.yml

---
 .github/workflows/gitlab.yml | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 .github/workflows/gitlab.yml

diff --git a/.github/workflows/gitlab.yml b/.github/workflows/gitlab.yml
new file mode 100644
index 0000000..8b8fa51
--- /dev/null
+++ b/.github/workflows/gitlab.yml
@@ -0,0 +1,30 @@
+name: Sync GitHub to GitLab
+
+on:
+  push:
+    branches:
+      - develop  # Se activa cuando hay cambios en la rama develop
+
+jobs:
+  sync:
+    runs-on: ubuntu-latest
+
+    steps:
+      # 1. Checkout del código desde GitHub
+      - name: Checkout GitHub repository
+        uses: actions/checkout@v4
+
+      # 2. Configurar Git para empujar a GitLab
+      - name: Push to GitLab main
+        env:
+          GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
+        run: |
+          # Configurar Git
+          git config --global user.name "github-actions[bot]"
+          git config --global user.email "github-actions[bot]@users.noreply.github.com"
+
+          # Agregar el repositorio remoto de GitLab
+          git remote add gitlab https://oauth2:${GITLAB_TOKEN}@labs.etsi.org/rep/ocf/sdk.git
+
+          # Forzar el push de la rama develop a main en GitLab
+          git push -u gitlab develop:main --force
-- 
GitLab