-
Notifications
You must be signed in to change notification settings - Fork 1
35 lines (32 loc) · 1.05 KB
/
Cleanup.RedistBranch.yaml
File metadata and controls
35 lines (32 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: "Cleanup.RedistBranch"
on:
pull_request:
types:
- closed
jobs:
cleanup-redist-branch:
name: "Cleanup Redist Branch"
if: >
github.event.pull_request.head.repo.full_name == github.repository &&
startsWith(github.event.pull_request.head.ref, 'redist-update/')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Lock PR conversation
run: |
PR_NUMBER="${{ github.event.pull_request.number }}"
echo "Locking PR #$PR_NUMBER to prevent further comments"
gh pr lock "$PR_NUMBER" --repo "${{ github.repository }}" --reason resolved
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete PR branch
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
echo "Deleting redist PR branch: $BRANCH_NAME"
gh api \
-X DELETE \
"repos/${{ github.repository }}/git/refs/heads/$BRANCH_NAME"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}