feat: Update issue templates #34
Workflow file for this run
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: Create Pull Request | |
| on: | |
| push: | |
| branches: | |
| - 'feature/**' | |
| - 'bugfix/**' | |
| jobs: | |
| create_pull_request: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Paso 1: Descargar el código. | |
| # fetch-depth: 0 es crucial para tener todo el historial y evitar problemas. | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Paso 2: Crear el Pull Request usando la CLI oficial de GitHub | |
| - name: Create Pull Request | |
| env: | |
| # El token de GitHub se pasa como una variable de entorno segura. | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # 1. Define a todo el equipo en una lista (array de bash) | |
| ALL_REVIEWERS=("Frasquito3" "LucaTvl" "NiconiKimg" "carlex74") | |
| # 2. Obtén el autor del PR desde las variables de GitHub | |
| PR_AUTHOR="${{ github.actor }}" | |
| # 3. Construye la lista final de revisores, excluyendo al autor | |
| FINAL_REVIEWERS="" | |
| for reviewer in "${ALL_REVIEWERS[@]}"; do | |
| if [[ "$reviewer" != "$PR_AUTHOR" ]]; then | |
| # Si la lista final no está vacía, añade una coma primero | |
| if [[ -n "$FINAL_REVIEWERS" ]]; then | |
| FINAL_REVIEWERS+=",${reviewer}" | |
| else | |
| FINAL_REVIEWERS+="${reviewer}" | |
| fi | |
| fi | |
| done | |
| echo "Autor del PR: ${PR_AUTHOR}" | |
| echo "Revisores finales asignados: ${FINAL_REVIEWERS}" | |
| # Le decimos a la CLI que la rama base es 'develop' | |
| BASE_BRANCH="develop" | |
| # Obtenemos el nombre de nuestra rama feature (ej: 'feature/mi-trabajo') | |
| HEAD_BRANCH="${{ github.ref_name }}" | |
| # Creamos un título y cuerpo para el PR | |
| TITLE="PR: Merge ${HEAD_BRANCH} into ${BASE_BRANCH}" | |
| BODY="Pull Request automático creado para la rama \`${HEAD_BRANCH}\`. Por favor, revisar." | |
| gh pr create \ | |
| --base "${BASE_BRANCH}" \ | |
| --head "${HEAD_BRANCH}" \ | |
| --title "${TITLE}" \ | |
| --body "${BODY}" \ | |
| --reviewer "${FINAL_REVIEWERS}" \ | |
| --label 'automated-pr,needs-review' |