Skip to content

Bump external-dns to latest stable version #3

Bump external-dns to latest stable version

Bump external-dns to latest stable version #3

name: Delete Merged Branches
on:
pull_request:
types:
- closed
jobs:
delete-branch:
# Only run if the PR was merged (not just closed)
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Delete merged branch
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
# Don't delete main/master or other protected branches
if [[ "$BRANCH_NAME" == "main" || "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "develop" ]]; then
echo "Skipping deletion of protected branch: $BRANCH_NAME"
exit 0
fi
echo "Deleting merged branch: $BRANCH_NAME"
gh api \
--method DELETE \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${{ github.repository }}/git/refs/heads/$BRANCH_NAME"
echo "Successfully deleted branch: $BRANCH_NAME"
env:
GH_TOKEN: ${{ github.token }}