From b8bd2dcfb94e019b06330a9ef72dd1d0d57b8946 Mon Sep 17 00:00:00 2001 From: dbarros1979 Date: Wed, 29 May 2024 19:13:09 +0000 Subject: [PATCH] Adding a way to delete Branches on PR Close --- .github/workflows/delete-closed-pr-branches.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/delete-closed-pr-branches.yml diff --git a/.github/workflows/delete-closed-pr-branches.yml b/.github/workflows/delete-closed-pr-branches.yml new file mode 100644 index 0000000000..c0e1df9b82 --- /dev/null +++ b/.github/workflows/delete-closed-pr-branches.yml @@ -0,0 +1,17 @@ +name: Delete Branches on PR Close +on: + pull_request: + types: + - closed +jobs: + delete-branch: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Delete branch + run: | + # Get the branch name from the pull request + BRANCH_NAME=$(echo "${{ github.event.pull_request.head.ref }}") + # Delete the branch + git push origin --delete "$BRANCH_NAME" \ No newline at end of file