diff --git a/.github/workflows/gitlab.yml b/.github/workflows/gitlab.yml new file mode 100644 index 0000000000000000000000000000000000000000..8b8fa5165872c990b9c3fcf1066de136ef771b87 --- /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