name: Bubble--Remove All Preview Apps

on:
  workflow_dispatch:
    inputs:
      pr-numbers:
        required: true
        type: string

jobs:
  destroy:
    name: Remove All Bubbles
    runs-on: ubuntu-latest
    env:
      REPO_NAME_WITH_OWNER: ${{ github.repository }}
    steps:
      - name: Begin Popping All Bubbles
        run: |
          for PR_NUMBER in ${{ inputs.pr-numbers }}
          do
            gh workflow run bubble_remove_branch_preview_apps.yml -f pr-number=$PR_NUMBER --repo ${{ env.REPO_NAME_WITH_OWNER }} -r main
          done
        env:
          GITHUB_TOKEN: ${{ secrets.BUBBLE_GITHUB_TOKEN }}
