I’ve successfully used the ignore command to skip unnecessary builds for my hugo sites until now. Today I pushed an update to one of my sites, and the build was skipped because of the ignore command. I tried several other updates, changing different files, and the build was still skipped.
After adding an echo command to print both $CACHED_COMMIT_REF and $COMMIT_REF to the console, what I was suspecting has been confirmed: $CACHED_COMMIT_REF and $COMMIT_REF are the same. How could this be?
When a build runs without cache, CACHED_COMMIT_REF will be the same as the COMMIT_REF.
What does that mean? When is the cache created, when is it cleared, what does it cache? I haven’t pushed updates to my sites in a while (couple of months). Could it be that the cache gets cleared, and when this happens CACHED_COMMIT_REF is gone?
How can I make my ignore command work again?
Thanks @luke, that’s of course the solution, I should have thought about it right away!
Still, I think it would make sense to update the docs here: Ignore builds | Netlify Docs to use as example the ignore command that uses the if statement - reading that page is easy to assume that CACHED_COMMIT_REF is never purged.