script to auto delete merged branch
This commit is contained in:
parent
bf87d24d6f
commit
ebcabc2492
1 changed files with 21 additions and 0 deletions
21
.github/workflows/delete_merged_branch.yml
vendored
Normal file
21
.github/workflows/delete_merged_branch.yml
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
name: Delete Merged Branch
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
delete_merged_branch:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event.pull_request.merged == true
|
||||||
|
steps:
|
||||||
|
- name: Delete branch
|
||||||
|
run: |
|
||||||
|
branch=${{ github.ref }}
|
||||||
|
if [ "$branch" != "refs/heads/main" ] && [ "$branch" != "refs/heads/master" ]; then
|
||||||
|
git push origin --delete "${branch#refs/heads/}"
|
||||||
|
else
|
||||||
|
echo "Skipping deletion of main or master branch"
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
Loading…
Reference in a new issue