name: Cleanup after PR

on:
  pull_request:
    types: [closed]

jobs:
  build:

    runs-on: ubuntu-latest
    
    steps:
    - name: Extract branch name
      shell: bash
      run: echo "##[set-output name=branch;](echo{GITHUB_REF#refs/heads/})"
      id: extract_branch
    - name: Delete folder on builds.jabref.org
      uses: appleboy/ssh-action@v0.0.3
      with:
        script: rm -rf www/${{ steps.extract_branch.outputs.branch }}
        host: builds.jabref.org
        username: builds_jabref_org
        privateKey: ${{ secrets.buildJabRefPrivateKey }}
        port: 9922

Remove the folder on build server once PR is merged
Remove the folder on build server once PR is merged