Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/actions/set-delete-branch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Delete Branch"
description: "Permite borrar una rama especifica del repositorio"
inputs:
Copy link

Copilot AI Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a token input so callers can supply a custom PAT or the default GITHUB_TOKEN, improving flexibility and security.

Copilot uses AI. Check for mistakes.
branchToDelete:
description: "Rama que sera eliminada"
required: true
baseBranch:
description: "Rama base del repositorio"
required: true
runs:
using: "composite"
steps:
- name: Borrando rama
shell: bash
run: |
Copy link

Copilot AI Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a check for branch existence before attempting deletion (e.g., git show-ref --verify --quiet refs/heads/${{ inputs.branchToDelete }}) to avoid errors when the branch is already gone.

Copilot uses AI. Check for mistakes.
git checkout ${{ inputs.baseBranch }}
git fetch; git pull
echo "Pasando a la rama base: ${{ inputs.baseBranch }}"
echo "Borrando rama: ${{ inputs.branchToDelete }}"
git push origin --delete ${{ inputs.branchToDelete }}
4 changes: 2 additions & 2 deletions .github/workflows/auto-release-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
- name: ✏️ CONFIGURACIONES PARA FIRMAR COMMITS
uses: ./.github/actions/git-config
with:
username: "Jmendez-Bot"
email: "jorge.mendez.ortega@gmail.com"
username: ${{ secrets.USER }}
email: ${{ secrets.EMAIL }}

- name: 📝 CREANDO RELEASE
uses: ./.github/actions/set-release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
- name: ✏️ CONFIGURACIONES PARA FIRMAR COMMITS
uses: ./.github/actions/git-config
with:
username: "Jmendez-Bot"
email: "jorge.mendez.ortega@gmail.com"
username: ${{ secrets.USER }}
email: ${{ secrets.EMAIL }}

- name: 📝 CREANDO RELEASE
uses: ./.github/actions/set-release
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/cleanup-merged-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: cleanup-merged-branch
description: "Elimina ramas que han sido mergeadas a develop"
Copy link

Copilot AI Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly declare permissions: at the top (e.g., contents: write) so the workflow has rights to delete branches with GITHUB_TOKEN.

Suggested change
description: "Elimina ramas que han sido mergeadas a develop"
description: "Elimina ramas que han sido mergeadas a develop"
permissions:
contents: write

Copilot uses AI. Check for mistakes.
on:
pull_request:
branches:
- develop
types:
- closed
jobs:
delete-merged-branch:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: ✏️ CONFIGURACIONES PARA FIRMAR COMMITS
uses: ./.github/actions/git-config
with:
username: ${{ secrets.USER }}
email: ${{ secrets.EMAIL }}
- name: 🗑 BORRANDO RAMA DEL ULTIMO MERGE
uses: ./.github/actions/set-delete-branch
with:
branchToDelete: ${{ github.event.pull_request.head.ref }}
baseBranch: develop
10 changes: 8 additions & 2 deletions .github/workflows/create-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
- name: ✏️ CONFIGURACIONES PARA FIRMAR COMMITS
uses: ./.github/actions/git-config
with:
username: "Jmendez-Bot"
email: "jorge.mendez.ortega@gmail.com"
username: ${{ secrets.USER }}
email: ${{ secrets.EMAIL }}

- name: 🔖 CREANDO ETIQUETAS
uses: ./.github/actions/set-labels
Expand Down Expand Up @@ -50,3 +50,9 @@ jobs:
defaultBranch: develop
token: ${{ secrets.MY_TOKEN }}
repo: ${{ github.repository }}

- name: 🗑 BORRANDO RAMA INICIAL
uses: ./.github/actions/set-delete-branch
with:
branchToDelete: init
baseBranch: develop