From 1a5cc1562b25afa8378f32ee18acf1bdd79c2156 Mon Sep 17 00:00:00 2001 From: Jorge Mendez Ortega Date: Mon, 2 Jun 2025 15:33:41 -0600 Subject: [PATCH] feat(actions): configuraciones para borrar ramas despues de un PR close #2 --- .github/actions/set-delete-branch/action.yml | 20 +++++++++++++++ .github/workflows/auto-release-beta.yml | 4 +-- .github/workflows/auto-release.yml | 4 +-- .github/workflows/cleanup-merged-branch.yml | 27 ++++++++++++++++++++ .github/workflows/create-label.yml | 10 ++++++-- 5 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 .github/actions/set-delete-branch/action.yml create mode 100644 .github/workflows/cleanup-merged-branch.yml diff --git a/.github/actions/set-delete-branch/action.yml b/.github/actions/set-delete-branch/action.yml new file mode 100644 index 0000000..80f1440 --- /dev/null +++ b/.github/actions/set-delete-branch/action.yml @@ -0,0 +1,20 @@ +name: "Delete Branch" +description: "Permite borrar una rama especifica del repositorio" +inputs: + 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: | + 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 }} diff --git a/.github/workflows/auto-release-beta.yml b/.github/workflows/auto-release-beta.yml index 49a8df9..cb98e85 100644 --- a/.github/workflows/auto-release-beta.yml +++ b/.github/workflows/auto-release-beta.yml @@ -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 diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 774d7e5..75118ca 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -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 diff --git a/.github/workflows/cleanup-merged-branch.yml b/.github/workflows/cleanup-merged-branch.yml new file mode 100644 index 0000000..fcd29f6 --- /dev/null +++ b/.github/workflows/cleanup-merged-branch.yml @@ -0,0 +1,27 @@ +name: cleanup-merged-branch +description: "Elimina ramas que han sido mergeadas a develop" +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 diff --git a/.github/workflows/create-label.yml b/.github/workflows/create-label.yml index b87bff0..e4e0440 100644 --- a/.github/workflows/create-label.yml +++ b/.github/workflows/create-label.yml @@ -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 @@ -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