# Using Node.js to skip builds

**URL:** <https://answers.netlify.com/t/using-node-js-to-skip-builds/51941>\
**Category:** Updates\
**Tags:** updates\
**Created:** [February 15, 2022, 2:15pm UTC](https://answers.netlify.com/t/using-node-js-to-skip-builds/51941 "2022-02-15T14:15:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehmicky](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/ehmicky/32/4051_2.png) [@ehmicky](https://answers.netlify.com/u/ehmicky)\
**Post date:** [February 15, 2022, 2:15pm UTC](https://answers.netlify.com/t/using-node-js-to-skip-builds/51941/1 "2022-02-15T14:15:10Z")

</div>

Specific builds [can be skipped](https://answers.netlify.com/t/support-guide-how-to-use-the-ignore-command/37517) using Netlify’s [`ignore` command](https://docs.netlify.com/configure-builds/common-configurations/ignore-builds/).

Previously, the `ignore` command could only run Bash commands and scripts. Node.js can [now also be used](https://docs.netlify.com/configure-builds/common-configurations/ignore-builds/#skip-builds-based-on-branch-name). 🎉

## Example

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

```toml
[build]
ignore = "node ignore_build.js"

```

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

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

```

## Caveats

- [Node.js dependencies](https://docs.netlify.com/configure-builds/manage-dependencies/#javascript-dependencies) from the site‘s `package.json` are not available.
- The Node.js version is always 12 and can’t be [customized](https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript).

---

<div class="post-metadata">

**Author:** ![talves](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/talves/32/101_2.png) [@talves](https://answers.netlify.com/u/talves)\
**Post date:** [February 15, 2022, 9:30pm UTC](https://answers.netlify.com/t/using-node-js-to-skip-builds/51941/4 "2022-02-15T21:30:50Z")

</div>

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

Would it be:

```nohighlight
[build]
ignore = "true"

```

---

<div class="post-metadata">

**Author:** ![ehmicky](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/ehmicky/32/4051_2.png) [@ehmicky](https://answers.netlify.com/u/ehmicky)\
**Post date:** [February 16, 2022, 1:43pm UTC](https://answers.netlify.com/t/using-node-js-to-skip-builds/51941/5 "2022-02-16T13:43:33Z")

</div>

Hi @talves,

Yes, this would work!  
The [following support guide](https://answers.netlify.com/t/support-guide-how-to-use-the-ignore-command/37517) has multiple examples, including the first one which is to ignore all builds. That guide uses `exit 0`, but `true` also works 👍

---

<div class="post-metadata">

**Author:** ![talves](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/talves/32/101_2.png) [@talves](https://answers.netlify.com/u/talves)\
**Post date:** [February 16, 2022, 4:29pm UTC](https://answers.netlify.com/t/using-node-js-to-skip-builds/51941/6 "2022-02-16T16:29:56Z")

</div>

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