name: comment-on-pr
on:
  pull_request:
    types: [opened]

jobs:
  comment_on_pr:
    name: Link to demo app
    runs-on: ubuntu-latest
    steps:
      - name: get PR number
        id: pr_number
        run: echo "::set-output name=pr_number::$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)"
      - name: comment PR
        uses: unsplash/comment-on-pr@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PR_NUMBER: ${{ steps.pr_number.outputs.pr_number }}
        with:
          msg: "Hey! If you'd like to test out the changes in this PR, check out our demo app. https://deploy-preview-${{ steps.pr_number.outputs.pr_number }}--authenticator-demo.netlify.com/"