Skip to content

Commit

Permalink
Add GitHub Actions workflow to delete branch after PR merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelk90 authored Jan 9, 2025
1 parent b393d4a commit 71a63ee
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/delete-branch-after-pr-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Delete branch after PR merge

on:
pull_request:
types:
- closed

jobs:
delete-branch:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Delete branch
run: |
BRANCH_NAME="${{ github.head_ref }}"
echo "Deleting branch: $BRANCH_NAME"
git push origin --delete "$BRANCH_NAME"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 71a63ee

Please sign in to comment.