[Support Guide] How can I disable automatic git deploys?

You could use our API to list deploys, too :slight_smile:

Hello all,

Is there any way of knowing if a deploy originated from a build hook from inside the ignore builds script?

With Vercel we have the deployment.meta.deployHookId which is very useful to short-circuit their Github App for preview environments deployment and take control over when to deploy when using Github Actions, but still benefitting from the Github App (comments in PR, deployment status in Github…).

Here’s what the ignore script looks like on Vercel: vercel-action/ignore-build.mjs at main · snaplet/vercel-action · GitHub

I’m trying to achieve the same thing on Netlify. :slight_smile:

This is a bit of a kludge but there is an environment variable which only exists when a webhook is used to trigger a deploy. The environment variable is named INCOMING_HOOK_BODY.

Even if no body is sent, the variable will be created for all webhook triggered deploys. If no webhook is used, the variable won’t be defined at all.

Will that meet your requirements in this case?

Yeah this could work, as far as I understand that endpoint, it returns a list of all the deploys but again I have to find in all of them the one that my site is “locked” too. Is there a way to filter the query to get just that one deploy id?

No, but filtering is not too difficult either:

const requiredDeploy = deploys.filter(deploy => {
  return deploy.id === '123' // check any condition that you need