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.
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
-
Node.js dependencies from the site‘s
package.json
are not available. - The Node.js version is always 12 and can’t be customized.