name: pr-preview-detect
# This workflow triggers on deployment, which can never happen on a fork.
on: deployment
jobs:
  detect-deployment:
    runs-on: ubuntu-18.04
    steps:
    - uses: actions/checkout@v1
      # By default, the "checkout" Action will attempt to check out the
      # revision to be deployed. Because it does not fetch GitHub Pull Request
      # branches, this will fail.
      with:
        ref: refs/heads/master
    - name: Install dependency
      run: pip install requests
    - name: Detect deployment
      run:
        ./tools/ci/pr_preview.py
          --host https://api.github.com
          --github-project web-platform-tests/wpt
          detect
          --target https://wptpr.live
          --timeout 600
      env:
        DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
