Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with directories if the target path already exists #16

Open
JordanPFVR opened this issue Sep 19, 2023 · 1 comment
Open

Comments

@JordanPFVR
Copy link

      - 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

@mihoci10
Copy link

I have opened a new pull request where I have fixed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants