Caching based on the checksum of a directory's contents


Inspired by a couple questions here, I wrote up a way to cache key based on your directories contents using md5sum. Hope it helps. (I’m sure there is a way to do this cleaner too)

      - run: |
          echo $(find ./migrations -type f -exec md5sum {} \; | md5sum | cut -d' ' -f1)  >> CACHE_KEY1
      - run: cat CACHE_KEY1
      - save_cache:
          key: test-cache-v1-{{ checksum "CACHE_KEY1" }}
            - migrations