The problem with this approach is that it only works for one build. In a repository with frequent commits, the build with cache restore gets skipped and superseded with a build which tries to restore cache.
Is there a way to reliably invalidate the cache without committing anything to the repo?
It would still pollute the commit history to some extent. Is it a known problem that the API call to delete the cache does not delete it? It seems to have been working at some point at least: