I have job which build storybook and it takes some time. So, I wanna cache this build artifact and reuse. However, there is no single folder including all the .stories
files. Therefore, I wanna use regex to specify all the .stories
files as key. Can I use regex as cache key to specify all the files which has .stories
extension?
It’s not possible to use regex in the cache key. I’ve seen people work around this by creating a basic text file that contains some state information. It can include hashes from multiple files, or some strings that represent a folder structure. Then you would checksum the file of the temporary state file you’ve created. If anything changes within the state file it will change the resulting cache key that checksums it, and caches will be recreated.
You could use regex from the shell in combination with some other tools to output a state file, and hash that file to know if caches should be recreated. This blog post describes the process better with some examples.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.