Skip to content

Enhance cache-dependency-path handling to support files outside the workspace root #1128

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

aparnajyothi-y
Copy link
Contributor

Description:
This PR enhances cacheDependencies in setup-python to properly handle cases where the cache-dependency-path file is located outside the workspace root also.

Related issue:
#476
#361

Check list:

[ X ] Mark if documentation changes are required.
[ X ] Mark if tests were added or updated to cover the changes.

@Copilot Copilot AI review requested due to automatic review settings June 9, 2025 08:18
@aparnajyothi-y aparnajyothi-y requested a review from a team as a code owner June 9, 2025 08:18
Copy link

@Copilot 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

Enhance the cacheDependencies action to support dependency files located outside the workspace by copying them into the workspace root before caching.

  • Exported cacheDependencies and added logic to resolve, copy, and log external dependency files.
  • Updated documentation to note support for external paths.
  • Added unit tests covering file copying, missing file warnings, and copy errors.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/setup-python.ts Exported cacheDependencies, added resolution and copy logic for external cache-dependency-path.
docs/advanced-usage.md Added note about external-path support for cache-dependency-path.
tests/setup-python.test.ts Added tests for copying dependencies, missing files, copy failures, and skipping when no input.
Comments suppressed due to low confidence (2)

src/setup-python.ts:67

  • The code computes resolvedDependencyPath but still passes the original cacheDependencyPath to getCacheDistributor, so the distributor won’t use the copied file location. Consider passing resolvedDependencyPath (or falling back to cacheDependencyPath) as the dependency-path argument.
const cacheDistributor = getCacheDistributor(

tests/setup-python.test.ts:59

  • Add a test case for when cache-dependency-path points to a file already inside the workspace (sourcePath === targetPath) to ensure the logic skips copying but still sets the resolved path correctly.
it('copies the dependency file and resolves the path with directory structure', async () => {

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.

1 participant