github-action-await-vercel icon indicating copy to clipboard operation
github-action-await-vercel copied to clipboard

How to get preview assigned to that branch

Open enesozturk opened this issue 10 months ago • 1 comments

Hey there,

Thanks much for such a library. It seems like exactly what I'm looking for. But I've confused on one thing; it expects deployment-url, but I have one deployment URL.What if I want to get preview of the deployment assigned to my PR/branch? Since the deployment keys are auto generated, where can I know what is my deployment-url of my PR?

If I pass my production app URL to deployment-url: my-app.vercel-app, it returns my-app-5elt1353h.vercel.app (see in the picture 5elt1353h is my latest production deployment build from main.

Image

But what I look is that I'm creating a PR from feat/my-branch, it should return the latest URL of deployment created from feat/my-branch

Isn't that possible?

enesozturk avatar Apr 16 '25 14:04 enesozturk

If i understand your problem correctly, here's how I get the url in 2 steps.

     - name: Get the Vercel preview url
        id: vercel_preview_url
        uses: zentered/[email protected]
        env:
          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
        with:
          vercel_project_id: 'your project id here'

      - name: Wait for Vercel Preview Deployment
        uses: UnlyEd/[email protected]
        env:
          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
        with:
          deployment-url: ${{ format('https://{0}', steps.vercel_preview_url.outputs.preview_url) }}
          timeout: 420
          poll-interval: 5

got it from here

thecontstruct avatar May 26 '25 18:05 thecontstruct