From f96b061618726389da2067b2c6400df6a5c2c672 Mon Sep 17 00:00:00 2001 From: EperezStemdo <166404865+EperezStemdo@users.noreply.github.com> Date: Tue, 30 Apr 2024 18:56:07 +0200 Subject: [PATCH] Update ejercicio3.yml --- .github/workflows/ejercicio3.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ejercicio3.yml b/.github/workflows/ejercicio3.yml index c299d739..fc47dd41 100644 --- a/.github/workflows/ejercicio3.yml +++ b/.github/workflows/ejercicio3.yml @@ -19,3 +19,19 @@ jobs: gh issue create --title "I found a bug" --body "${issue_body}" -a "EperezStemdo" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - run: | + pull_request_url="${{ github.event.pull_request.html_url }}" + issue_body="This issue is related to pull request: [${pull_request_url}](${pull_request_url})" + gh issue create --title "I found a bug" --body "${issue_body}" -a "EperezStemdo" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Cerrar issue cuando se cierra la pull request + if: github.event.pull_request.merged == true || github.event.pull_request.closed_at != null + #github.event.pull_request.closed_at != null es una condición que verifica si el campo closed_at en el JSON del evento de la solicitud de extracción tiene un valor diferente de null. Este campo contiene la fecha y hora en que se cerró la solicitud de extracción. + run: | + issue_number=$(echo '${{ github.event.pull_request.number }}') + gh issue close $issue_number + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}