48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
name: Auto-Merge Dev
|
|
run-name: Merging changes from dev
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
branches: ["feature/*"]
|
|
push:
|
|
branches: ["feature/*"]
|
|
workflow_dispatch:
|
|
inputs:
|
|
branch:
|
|
description: "Branch to merge from dev"
|
|
required: true
|
|
default: "feature/example"
|
|
|
|
jobs:
|
|
auto-merge-dev:
|
|
runs-on: windows # Ejecutar directamente en el host Windows
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
|
|
- name: Configure git user
|
|
run: |
|
|
git config user.name "github-actions"
|
|
git config user.email "github-actions@github.com"
|
|
shell: powershell
|
|
|
|
- name: Merge changes from dev
|
|
run: |
|
|
# Obtener la última versión de todas las ramas
|
|
git pull origin dev
|
|
|
|
# Intentar hacer merge de dev a la rama feature actual
|
|
git merge origin/dev --allow-unrelated-histories
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
# Si el merge fue exitoso (sin conflictos), hacer push
|
|
git push
|
|
} else {
|
|
# Si hubo conflictos, mostrar mensaje y salir con error para detener el pipeline
|
|
Write-Host "Conflictos detectados en el merge de dev a $branch, por favor resolver manualmente."
|
|
exit 1
|
|
}
|