Hey HN! We work with GitHub Actions to build and deploy Docker images. This works, but many repositories contain files that don't end up in the final image, such as tests, tooling configuration, or developer documentation. Yet, every time these files change, an action workflow will build the same Docker image, but with new tags!
I was tired of both waiting for long workflows as well as burning build minutes, so I thought about a solution to the problem: You want to be able to skip builds if everything ending up in the build context doesn't change. That turned out to be more annoying than I thought initially; Docker provides no way of listing all files in the context short of actually building the image.
So instead, I created a very simple action that will generate a hash of all files in your repository, minus those matched by your .dockerignore file. You can then use this hash as the cache key deciding whether to run the build step, or just proceed with the previously pushed tag.
Here's a gist displaying an example workflow end-to-end: https://gist.github.com/Radiergummi/eec012d154ce0400032f3b1a...
Yes, it's a neat Rube Goldberg machine. Yes, it solves a real problem—and also money. Maybe one of you can benefit from this as well :-)