Build.zig do step if certain directory changes?

Configure cache poisoning should solve it for you. Specifically, either std.Build.dependOnDirectoryMetadata or std.Build.dependOnDirectoryContents. The difference is described in their documentation. Beware: they are not recursive.

To a similar problem: