diff --git a/.github/workflows/deploy_preview.yml b/.github/workflows/deploy_preview.yml index 28f8e4b..cc8442c 100644 --- a/.github/workflows/deploy_preview.yml +++ b/.github/workflows/deploy_preview.yml @@ -20,6 +20,8 @@ jobs: deploy-preview: needs: [test] runs-on: ubuntu-latest + permissions: + pull-requests: write # Do not run for PR from forks if: github.event.pull_request.head.repo.full_name == github.repository @@ -37,4 +39,11 @@ jobs: run: vercel build --token=${{ secrets.VERCEL_TOKEN }} - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --archive=tgz --token=${{ secrets.VERCEL_TOKEN }} + id: deploy_step + run: echo "preview-url=$(vercel deploy --prebuilt --archive=tgz --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT + + - name: Comment Preview URL + uses: marocchino/sticky-pull-request-comment@v2 + with: + message: | + Preview: ${{ steps.deploy_step.outputs.preview-url }}