Is there a way to extract the deploy preview URL as part of a GitHub action or some other service?
My hope is to be able to create a notification that is directly linked to the deploy preview rather than the pull request.
Is there a way to extract the deploy preview URL as part of a GitHub action or some other service?
My hope is to be able to create a notification that is directly linked to the deploy preview rather than the pull request.
Hi, @adamavenir, and welcome to our Netlify community site.
The deploy preview URL is an environment variable available during the site build in the build system which performs the build.
The environment variable is named DEPLOY_URL
.
Would utilizing this environment variable and sending the notification from the build process itself meet the requirements for your use case?
Maybe, though I’m not quite sure how I’d do that.
Ultimately what I want to do is get a rich notification on my phone / iPad (using something like IFTTT) that has a URL that goes straight to the preview.
If there was a webhook that could send that as its payload that would be great.
I did discover after posting this that there are a whole bunch of configurable deploy notifications in Netlify’s dashboard, which is perfect, but deploy preview urls are not available to neither slack notifications nor webhooks.
The webhook does already exist as you’ve discovered, and the URL for the deploy is in it, in JSON. Are you not seeing it there? The slack notification does not show it by default, but you could of course forward to slack via a webhook processing service like Zapier to make sure it is included, since we do send it
Hi! I just found this thread, so I’ll reuse it instead of creating a new one.
I had today the same issue as @adamavenir, where I’d like to get the deploy preview url from the “Deploy succeeds” webhook. The deploy preview url is definitely not available in the webhook payload at the moment.
The only “internal” available url is the "deploy_url": "https://master--xxx.netlify.app"
one.
As a temporary workaround, I’m using the id
field, and manually creating this url, but I believe it is not a future-proof way of fixing the issue