entry-delete-branch.ymlΒΆ

# Enters the same concurrency group as entry-push-latest.yml for the deleted
# branch, which cancels that run and all its child workflow_call runs.
#
# On `delete` events `github.ref_name` resolves to the default branch, not the
# deleted ref, so the group keys on `github.event.ref`. Keying on `ref_name`
# would collide with the push-to-main CI and cancel it.

name: "🚫 Cancel: Runs on Branch Delete"

on:
  delete:

concurrency:
  group: global-ci-${{ github.repository }}-${{ github.event.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  cancel-branch-runs:
    if: ${{ github.event.ref_type == 'branch' }}
    runs-on: ubuntu-26.04
    permissions:
      actions: write
      contents: read
    steps:
      - name: ⬇️ Checkout
        uses: actions/checkout@v7.0.0

      - name: 🚫 Cancel active workflow runs for deleted branch
        shell: bash
        env:
          BRANCH: ${{ github.event.ref }}
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          REPOSITORY: ${{ github.repository }}
        run: bash scripts/github/cancel/branch_runs.sh