# This file was automatically generated by github-actions-wac. # DO NOT MODIFY IT BY HAND. Instead, modify the source *.wac.ts file(s) # and run "github-actions-wac build" (or "ghawac build") to regenerate this file. # For more information, run "github-actions-wac --help". name: Delete Merged Release Branch 'on': pull_request: types: - closed branches: - next - release/*-base jobs: deleteBranch: name: Delete release branch if: >- ${{ github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - name: Delete branch env: GH_TOKEN: ${{ secrets.GH_TOKEN }} REPO: ${{ github.repository }} HEAD_REF: ${{ github.event.pull_request.head.ref }} BASE_REF: ${{ github.event.pull_request.base.ref }} run: |- set -e # Delete the head release branch (Y) that was just merged. gh api --method DELETE "/repos/$REPO/git/refs/heads/$HEAD_REF" echo "Deleted head branch: $HEAD_REF" # For tag-based (patch) releases the PR base is a throwaway # "release/x.y.z-base" branch (X) - delete it too. Never delete next. case "$BASE_REF" in release/*-base) gh api --method DELETE "/repos/$REPO/git/refs/heads/$BASE_REF" echo "Deleted base branch: $BASE_REF" ;; *) echo "Base branch $BASE_REF is not a release base branch; leaving it in place." ;; esac runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false permissions: contents: read actions: write