Inline ignore command doesn't work with latest build image

Recently we’ve upgraded to the latest build image (Focal) for We have a custom inline build.ignore command in the netlify.toml file to only build when the docs change:

  ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF docs package.json pnpm-lock.yaml netlify.toml"

When building, the command above would always return exit code 0, skipping any builds, even if it should match a file change.

We have tried extracting the command into a bash script, which now builds, but doesn’t ignore builds as expected. (Fixed by giving the bash script execution permissions)

The deploy logs can be found at Netlify App.

The main logs are:

  • Docs change is incorrectly ignored: Netlify App
  • Changing to bash script works: Netlify App
  • After changing to bash script, branch deploys (based on main branch) are not properly ignored. The PR isn’t touching any docs. Netlify App

Note: We have recently disabled deploy previews too as we have a secondary deployment site at for deploy previews, that’s for

PS: I had to codify some links as I’m limit to 6 links only.

Hey @bluwy,

This is interesting, the inline ignore command does work on the focal image too - a lot of other folks are using it.

Just as the most basic IT advice (and I’m sorry, I’m even suggesting this), did you try to turn this off and on again? As in, does the same happen if you create a new site connected to the same repo?

Since the new site would be created on focal by default, it should not have any “side-effects” of the migration if there were any in this current site.

Let us know how that goes.

No worries :smile: Yes I should’ve mentioned this too, we (or Evan) did try re-creating a new site connected to the same repo, and it fails to build too. The site is now deleted though, but perhaps we can spin it up again if it helps debugging?

Update: Looks like the custom bash script works now. We had to give it execution permissions for it to work. So now we have a workaround for the inline ignore command not working.

Hey there, @bluwy :wave:

Thanks for coming back and sharing that update with us! I am glad you have found a workaround. Let us know if you have any lingering questions or if we can support you with anything else.

Happy building :rocket:

I suppose it’s still strange that an inline ignore command doesn’t work, which I think might be a bug. But I’ll mark the workaround as the solution for now. Thanks!

1 Like

Hi, @bluwy. I think the root cause here was misidentified. Looking at some builds which did not trigger, I see this the logs:

Failed to fetch cache, continuing with build

The CACHED_COMMIT_REF is determined by checking the cached repo. In the build with the fail cache fetches, this causes the repo to be downloaded fresh and when that happens the CACHED_COMMIT_REF and COMMIT_REF are identical. It might help to add logic to the inline check to return a non-zero value if the two values are identical so it will always force a build when this happens.

Thanks for the tip @luke (and sorry for the late reply). That explains the issue we’re seeing and would be a good solution, but we’ve been using the workaround for so long that there’s no reason to go back to inline again :sweat_smile: Maybe it would help someone in the future though!

1 Like