feat: Create delete-merged-branches #1
Workflow file for this run
This file contains 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: Delete Merged Branch | |
on: | |
pull_request: | |
types: [closed] | |
jobs: | |
delete-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Delete Merged Branch | |
if: github.event.pull_request.merged == true | |
run: | | |
# Extract branch name from the ref | |
BRANCH_NAME=$(echo "${{ github.event.pull_request.head.ref }}" | cut -d'/' -f3-) | |
# Delete the merged branch | |
git push --delete origin $BRANCH_NAME |