We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f8ed7fc commit 69ee882Copy full SHA for 69ee882
1 file changed
.github/workflows/delete-merged-branch.yml
@@ -0,0 +1,23 @@
1
+name: Delete Merged Branch
2
+
3
+on:
4
+ pull_request:
5
+ types:
6
+ - closed
7
8
+permissions:
9
+ contents: write
10
11
+jobs:
12
+ delete-branch:
13
+ if: >
14
+ github.event.pull_request.merged == true &&
15
+ github.event.pull_request.head.repo.full_name == github.repository &&
16
+ github.event.pull_request.head.ref != github.event.repository.default_branch &&
17
+ github.event.pull_request.head.ref != 'main'
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - name: Delete merged branch
21
+ run: |
22
+ git push "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" \
23
+ --delete "${{ github.event.pull_request.head.ref }}" || true
0 commit comments