actions icon indicating copy to clipboard operation
actions copied to clipboard

Show preview URL to as a PR message

Open oriolpuig opened this issue 5 years ago • 1 comments

Hi,

First of all, congrats to all of contributors, because following your docs, I could setup a Github Action to deploy my application while PR is created or any push to master has done very easy. I guess it takes me no more than 1h!

Sorry if exist that documentation but, could be possible to add a new message at the PR adding the preview URL? I saw Now.sh or Vercel do that.

Thanks in advance!

oriolpuig avatar May 16 '20 12:05 oriolpuig

hi there @oriolpuig I was just playing with this action. In case you still are wondering how to do it.

Just make sure to use an id in your deployment step and then you can access the preview and live url.

      - name: Deploy to Netlify
        id: deploy-neflify
        uses: netlify/actions/cli@master
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
        with:
          args: deploy --dir=dist

      - name: Netlify Preview URL
        uses: unsplash/comment-on-pr@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          OUTPUT: "This pull request is being automatically deployed to Netlify.\n\n🔍 Inspect: ${{ steps.deploy-neflify.outputs.NETLIFY_LOGS_URL }}\n✅ Preview: ${{ steps.deploy-neflify.outputs.NETLIFY_URL }}"
        with:
          msg: ${{ env.OUTPUT }}
          check_for_duplicate_msg: false

this is my full workflow https://github.com/calitb/VueJS-Sample/blob/master/.github/workflows/deploy_staging.yml

calitb avatar Jul 22 '20 04:07 calitb