fix delete_merged_branch (#282)

This commit is contained in:
Tran M. Cuong 2024-08-23 13:46:09 +07:00 committed by Cuong-Tran
parent be9dbc50ea
commit 4ae222e247
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2

View file

@ -9,11 +9,15 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Delete branch
run: |
branch=${{ github.ref }}
branch_name=$(echo "${{ github.event.pull_request.head.ref }}")
if [ "$branch" != "refs/heads/main" ] && [ "$branch" != "refs/heads/master" ]; then
git push origin --delete "${branch#refs/heads/}"
echo "Deleting branch ${branch_name}"
git push origin --delete $branch_name
else
echo "Skipping deletion of main or master branch"
fi