Skip to content

Commit de3b771

Browse files
committed
Delete branch once redist merged via workflow automatically
1 parent ed5a97a commit de3b771

File tree

1 file changed

+27
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)