🤖 Auto-update client-preview-old redist files #12
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |