Using Node.js to skip builds

Specific builds can be skipped using Netlify’s ignore command.

Previously, the ignore command could only run Bash commands and scripts. Node.js can now also be used. :tada:

Example

To skip builds for a specific branch, add a Node.js script in your netlify.toml file:

[build]
ignore = "node ignore_build.js"

Then, in ignore_build.js, write the ignore logic:

process.exitCode = process.env.BRANCH.includes("debug") ? 0 : 1

Caveats

2 Likes

Can you include an example of an easy ignore value hard coded?

Would it be:

[build]
ignore = "true"

Hi @talves,

Yes, this would work!
The following support guide has multiple examples, including the first one which is to ignore all builds. That guide uses exit 0, but true also works :+1:

1 Like

Thanks @ehmicky . This would work great for people not wanting to build. Great addition. Keep up the great work. :pray:

1 Like