name: Cleanup Review App
on:
  pull_request:
    types: [closed]

env:
  FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
  APP_NAME: pr-${{ github.event.pull_request.number }}-jasterv-spazio-solazzo

jobs:
  review_app_cleanup:
    runs-on: ubuntu-latest

    concurrency:
      group: pr-${{ github.event.number }}

    environment:
      name: review

    steps:
      - name: Destroy PR app
        uses: superfly/fly-pr-review-apps@1.5.0
        with:
          name: ${{ env.APP_NAME }}
          config: fly.review.toml
