Canceling build and Pull Request in Github

Hello!

Whenever build is canceled via netlify plugin, Github hooks see it as failed task. There was no such issue when we used “build.ignore” via netlify.toml (that setup stopped working for us about 2 weeks ago, so we switched to cancelling builds via plugin)

I followed more or less the tutorial here: https://www.netlify.com/blog/2020/04/21/deploying-nx-monorepos-to-netlify/. More or less because we have different tech stack, as we use Lerna instead of Nx.

Netlify tells on the (sorry for no pictures, there is limit of 1 image for new users :frowning:) “deploys” page that the build was canceled: “Canceled by Plugin”.

Similar thing says Deploy summary:

Build canceled by ./tools/plugins/netlify/stop-build

Build was cancelled because package ‘shared’ was not affected by the latest changes

this is part of a log that the build:
11:47:52 AM: ┌──────────────────────────────────────────────────────┐
11:47:52 AM: │ Build canceled by ./tools/plugins/netlify/stop-build │
11:47:52 AM: └──────────────────────────────────────────────────────┘
11:47:52 AM: ​
11:47:52 AM: Build was cancelled because package ‘shared’ was not affected by the latest changes
11:47:52 AM: ​
11:47:52 AM: Caching artifacts
11:47:52 AM: Started saving node modules
11:47:52 AM: Finished saving node modules
11:47:52 AM: Started saving yarn cache
11:47:52 AM: Finished saving yarn cache
11:47:52 AM: Started saving pip cache
11:47:52 AM: Finished saving pip cache
11:47:52 AM: Started saving emacs cask dependencies
11:47:52 AM: Finished saving emacs cask dependencies
11:47:52 AM: Started saving maven dependencies
11:47:52 AM: Finished saving maven dependencies
11:47:52 AM: Started saving boot dependencies
11:47:52 AM: Finished saving boot dependencies
11:47:52 AM: Started saving go dependencies
11:47:52 AM: Finished saving go dependencies
11:47:55 AM: Execution cancelled
11:47:55 AM: Error running command: Command was cancelled
11:47:55 AM: Failing build: Failed to build site
11:48:25 AM: Failed to inform the API about a failed build, please retry the build or contact support
11:48:25 AM: Finished processing build request in 2m16.09255553s

this is what Github says us;

this is a part of a code of plugin that cancels the build:

if (!projectHasChanged) {
  utils.build.cancelBuild(
    `Build was cancelled because package '${currentPackageName}' was not affected by the latest changes`
  );
}

The goal is to be able to cancel build via plugin, so the Github sees it as cancelled/skipped, not failed.

Thank for help in the advance !

1 Like

Hi @chmurson,

You’re correct, this is a bug.
We have tracked this problem in the following issue: https://github.com/netlify/build/issues/1224
We’ll let you know as soon as this is fixed!

1 Like