Feature/b2 cfront 5765 #42
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: Cleanup Branch | |
on: | |
pull_request: | |
types: | |
- closed | |
jobs: | |
cleanup: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Delete branch if it's not a protected branch | |
run: | | |
branch_name=${{ github.event.pull_request.head.ref }} | |
if [[ ! "$branch_name" =~ ^(master|stand/release|beta/nalog)$ ]]; then | |
if git show-ref --verify --quiet refs/heads/$branch_name; then | |
git push origin --delete $branch_name | |
else | |
echo "Branch $branch_name already deleted." | |
fi | |
else | |
echo "Branch $branch_name is protected and will not be deleted." | |
fi |