name: Remove preview PR
on:
  pull_request_target:
    types: [ closed ]

jobs:
  build:
    runs-on: "ubuntu-22.04"
    if: github.repository_owner == 'php'
    steps:
      - uses: appleboy/ssh-action@v1.2.0
        with:
          host: ${{ secrets.PREVIEW_REMOTE_HOST }}
          username: ${{ secrets.PREVIEW_REMOTE_USER }}
          key: ${{ secrets.PREVIEW_SSH_KEY }}
          script: |
            bash /home/thephpfoundation/scripts/pr_closed.sh web-php ${{ github.event.number }}
            bash /home/thephpfoundation/scripts/pr_closed.sh web-php-regression-report ${{ github.event.number }}
