Skip to content

Commit 0c3e491

Browse files
authored
Merge pull request #13 from EnderModuBot/maintaince/11-branch-soll-nach-merge-automatisch-gelöscht-werden-end
füge Workflow zum Löschen von zusammengeführten Branches hinzu
2 parents 71e0e0f + 935b822 commit 0c3e491

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Delete merged branch
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
jobs:
9+
delete-branch:
10+
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Delete merged branch
14+
run: |
15+
branch="${{ github.event.pull_request.head.ref }}"
16+
repo="${{ github.repository }}"
17+
token="${{ secrets.GITHUB_TOKEN }}"
18+
if [[ "$branch" != "main" && "$branch" != "master" ]]; then
19+
curl -s -X DELETE \
20+
-H "Authorization: Bearer $token" \
21+
-H "Accept: application/vnd.github+json" \
22+
"https://api.github.com/repos/$repo/git/refs/heads/$branch"
23+
fi

0 commit comments

Comments
 (0)