Auto-delete feature/bug branches after merge

This commit is contained in:
aditya.chandel
2025-03-24 00:51:28 -06:00
committed by Aditya Chandel
parent 9473a5e413
commit 6631b44bbc
+11 -1
View File
@@ -84,4 +84,14 @@ jobs:
run: |
gh release create ${{ env.new_tag }} \
--title "Release ${{ env.new_tag }}" \
--notes "Automated release for ${{ env.new_tag }}"
--notes "Automated release for ${{ env.new_tag }}"
- name: Delete Feature/Bug Branches (Only for Master and Develop)
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
run: |
git fetch --prune
for branch in $(git branch -r | grep 'origin/feature/' || grep 'origin/bug/'); do
branch_name=${branch#origin/}
echo "Deleting branch: $branch_name"
git push origin --delete "$branch_name"
done