Skip to content

🤖 Auto-update client-preview-publicized redist files #10

🤖 Auto-update client-preview-publicized redist files

🤖 Auto-update client-preview-publicized redist files #10

Workflow file for this run

name: "Redist Cleanup"
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
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Locking PR #${{ github.event.pull_request.number }}"
gh pr lock "${{ github.event.pull_request.number }}" --repo "${{ github.repository }}" --reason resolved || true
# Only delete after a successful merge. Never delete the branch of a PR
# that was closed without merging (it may contain work to investigate).
# PRs closed-as-unnecessary by create-pull-request are already cleaned up
# by its delete-branch:true, so this is the merge case.
- name: Delete merged PR branch
if: github.event.pull_request.merged == true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
echo "Deleting merged redist PR branch: $BRANCH_NAME"
gh api -X DELETE "repos/${{ github.repository }}/git/refs/heads/$BRANCH_NAME" || true