komikku/.github/workflows/delete_merged_branch.yml
littlecodedragon 5351e4a2f8
Some checks failed
Forgejo Release Builder / release (push) Failing after 0s
ci: make workflows Forgejo runner compatible
Pin workflow actions to node20-compatible versions and replace node24-only dependencies so jobs run on Forgejo runner v3.5.1.

Made-with: Cursor
2026-04-26 17:11:53 +02:00

28 lines
854 B
YAML
Executable file

name: Delete Merged Branch
on:
pull_request:
types: [closed]
permissions:
contents: write
jobs:
delete_merged_branch:
runs-on: 'ubuntu-24.04'
if: github.event.pull_request.merged == true && github.repository == github.event.pull_request.head.repo.full_name
steps:
- name: Checkout repository
uses: actions/checkout@v4 # Forgejo-compatible (node20)
- name: Delete branch
run: |
branch_name=$(echo "${{ github.event.pull_request.head.ref }}")
if [ "$branch" != "refs/heads/main" ] && [ "$branch" != "refs/heads/master" ]; then
echo "Deleting branch ${branch_name}"
git push origin --delete $branch_name
else
echo "Skipping deletion of main or master branch"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}