name: PR Closed

on:
  pull_request:
    branches: [main, next]
    types: [closed]

jobs:
  docs:
    name: Remove Docs Preview
    runs-on: ubuntu-latest
    steps:
      - name: Teardown
        uses: adrianjost/actions-surge.sh-teardown@v1.0.3
        with:
          regex: pr-${{ github.event.number }}--ruma-docs.surge.sh
        env:
          SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
          SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
      
      - name: Remove preview URL
        uses: Beakyn/gha-comment-pull-request@v1.0.2
        id: deploy-preview
        env:
          GITHUB_TOKEN: ${{ github.token }}
        with:
          description-message: Preview removed

Remove docs preview when PR is closed
ci: Remove docs preview when PR is closed
