Skip to content

Commit 1d36576

Browse files
committed
Add auto-delete branch workflow
Closes: #109
1 parent 7ef7c61 commit 1d36576

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Delete "update" branch after merge
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
delete-branch:
9+
if: >
10+
github.event.pull_request.merged == true &&
11+
startsWith(github.event.pull_request.head.ref, 'updates/update_')
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Delete branch
17+
env:
18+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
run: |
20+
BRANCH="${{ github.event.pull_request.head.ref }}"
21+
echo "Deleting branch: $BRANCH"
22+
gh api \
23+
-X DELETE \
24+
repos/${{ github.repository }}/git/refs/heads/$BRANCH

0 commit comments

Comments
 (0)