- name: Local cache for current JS Bundle based on SHA
id: js-bundle-cache
uses: MasterworksIO/action-local-cache@2
with:
path: './release/app'
key: ${{ steps.read_yaml.outputs.sha }}
For the following configuration the post step will successfully cache the ./release/app directory under the correct path intentional path (prefix'd with the org name and cache key).
On subsequent runs, if the path defined by targetPath already exists, @actions/io mv will append the target path with the basename of the given path...
We can see this behaviour here: https://github.com/actions/toolkit/blob/main/packages/io/src/io.ts#L91
The result is the cache is incorrectly restored into ./release/app/app/.
The fix is to use targetDir rather than targetPath when working with directories.
https://github.com/MasterworksIO/action-local-cache/blob/main/src/main.ts#L15
For the following configuration the
poststep will successfully cache the./release/appdirectory under the correct path intentional path (prefix'd with the org name and cache key).On subsequent runs, if the path defined by
targetPathalready exists,@actions/iomvwill append the target path with the basename of the given path...We can see this behaviour here: https://github.com/actions/toolkit/blob/main/packages/io/src/io.ts#L91
The result is the cache is incorrectly restored into
./release/app/app/.The fix is to use
targetDirrather thantargetPathwhen working with directories.https://github.com/MasterworksIO/action-local-cache/blob/main/src/main.ts#L15