Auto-delete feature/bug branches after merge

This commit is contained in:
aditya.chandel
2025-03-22 02:44:43 -06:00
committed by Aditya Chandel
parent c957f56b86
commit 123c0e9b7d
+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