Skip to content

Conversation

@smockle
Copy link
Collaborator

@smockle smockle commented Dec 10, 2025

When key includes /, gh-cache/save failed with the following error:

cp: cannot create regular file 'foo/bar.json': No such file or directory

This PR fixes the error by creating the destination directory(s) before performing the copy.

I validated this fix:

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the GitHub Actions cache save action where copying files to nested directories would fail if the parent directories didn't already exist in the cache branch. The fix adds a mkdir -p command to create the necessary directory structure before attempting the copy operation, following the same pattern already used in the restore action.

Key Changes:

  • Added directory creation step before file copy operation to prevent "No such file or directory" errors

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@smockle smockle merged commit c422537 into main Dec 10, 2025
11 checks passed
@smockle smockle deleted the smockle/mkdir-before-cp branch December 10, 2025 21:18
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

Successfully merging this pull request may close these issues.

3 participants