Deploying Preview Web Hook via API

I had to get around this "New Users may only post one picture thing.


Text for searching:

Here is my scenario:
On GitHub, I’ve made some “GitHub Actions” that use the netlify cli to publish a deploy preview.
The issue I’m having is that once I publish the deploy preview, there is no hook to tell github that for the PR I have open, netlify should tell github that my PR has had a deploy.

For example, I have this PR: https://github.com/NullVoxPopuli/emberclear/pull/128
With this C.I. Action: https://github.com/NullVoxPopuli/emberclear/runs/215801319
That outputs this Preview URL: https://5d75a4c7c33b02edf8deb8e8–emberclear.netlify.com

And on Netlify, It is receiving info:

And I have these for my Notification Settings:

(I think these are default).

Fwiw, I know I could just let the Netlify UI handle this and build and deploy and notify for me, but I want more control over the build environment, which is why I’m doing this on C.I. / GitHub Actions (but really, the specific platform is irrelevant, as this should be possible with bash / the netlify cli?)

I was figuring that maybe I could manually trigger a Deploy Preview Notification somehow?
Or maybe this is a bug?
Or is there some super obvious way to achieve what I want that I have missed?

This is what the last success looked like:

I was hoping that once a deploy preview was made, some netlify stuff would show up in there.

This is how I’m doing the deploy preview: https://github.com/NullVoxPopuli/emberclear/blob/netlify-branch-deploys/.github/workflows/frontend-deploy-preview.yml#L41

DEPLOY_URL=$(\
  netlify deploy --dir=packages/frontend/dist --json \
  | jq '.deploy_url' --raw-output \
)

my hunch is that there needs to be a sha or branch ref in order to get a notification posted back to the PR?
As is, I only get email notifications.

If I specify a build command in netlify,

all the automated stuff happens:


Which is ok if I were to never need to “Gate” deploys.
Additionally, there are a lot of extra entries in the checks now. All I really need is deploy/netlify

When we use the term deploy preview, we are talking only about builds from PR’s:

There is no way except by pushing another commit from the PR for you to build a deploy preview. I can cause a rebuild on a deploy preview for you if you ask me to, but it will use all old settings from the last run, so it’s not clear what benefit that would bring (e.g. won’t see changed environment variables or other build settings; will pull the same commit ref from your repo).

You can publish a “draft” deploy manually using the netlify CLI, but it will be its own thing based on your local files, unrelated to anything in git.

can there be an API (or is there an existing one?) to declare a draft deploy as a deploy preview? or tie a deploy to git somehow?

This would be super useful for me (and many others, from what I’ve read :slight_smile: )

Something I noticed in that Deploy Previews doc,
image
how do they only have one netlify entry? I have 5 in my PR Checks if I use the built-in deploy preview functionality

Looks like the answer to this is to remove all the “details” outgoing webhooks from the notifications section of the deploy settings page.

I guess the solve for my original question would be to maybe do one of the following?:

  • add a sha argument to netlify deploy to tie to a commit / PR, this would hopefully trigger the deploy notifications?
  • add an api for triggering a deploy notification, allowing the specification of a sha to tie to a commit/PR

So, I know what I want isn’t possible today. But I guess this is a feature request :slight_smile:

hi @NullVoxPopuli - i’ve moved this thread to the #netlify-platform:feedback-features-pricing area so we can review it in more detail. No promises on whether this might happen or when, but we’ll look into it!

Sounds good!

Fwiw, I think it’d benefit everyone. If people can gate their deploy previews, that would maybe save you all a toooon of server usage time.

1 Like