name: Deploy Pull Request
#This is triggered by deployments to the repository
on: [pull_request]

jobs:
  # TODO: run tests
  deploy:
    name: Deploy To Now
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1

      - name: Generate Now Config
        uses: ./.github/actions/generate-now-config
        with:
          branch: ${{ github.head_ref }}
          location: ./now.feature.json

      - name: Deploy to Now
        env:
          ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }}
          DB_TABLE: ${{ secrets.ZEIT_TOKEN }}
        run: now --token $ZEIT_TOKEN --no-clipboard --local-config ./now.feature.json --prod
