From 08ee4fc403ac1161ba650e07818b2769fbb31b68 Mon Sep 17 00:00:00 2001 From: Aparna Jyothi Date: Mon, 9 Jun 2025 12:56:17 +0530 Subject: [PATCH] updated logic --- dist/setup/index.js | 14 ++++++++------ src/setup-python.ts | 16 +++++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 4da6c476..694147e8 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -96934,12 +96934,14 @@ function cacheDependencies(cache, pythonVersion) { core.warning(`The resolved cache-dependency-path does not exist: ${sourcePath}`); } else { - try { - fs_1.default.copyFileSync(sourcePath, targetPath); - core.info(`Copied ${sourcePath} to ${targetPath}`); - } - catch (error) { - core.warning(`Failed to copy file from ${sourcePath} to ${targetPath}: ${error}`); + if (sourcePath !== targetPath) { + try { + fs_1.default.copyFileSync(sourcePath, targetPath); + core.info(`Copied ${sourcePath} to ${targetPath}`); + } + catch (error) { + core.warning(`Failed to copy file from ${sourcePath} to ${targetPath}: ${error}`); + } } } resolvedDependencyPath = path.relative(workspace, targetPath); diff --git a/src/setup-python.ts b/src/setup-python.ts index e5a5c6e7..c2665bfa 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -42,13 +42,15 @@ export async function cacheDependencies(cache: string, pythonVersion: string) { `The resolved cache-dependency-path does not exist: ${sourcePath}` ); } else { - try { - fs.copyFileSync(sourcePath, targetPath); - core.info(`Copied ${sourcePath} to ${targetPath}`); - } catch (error) { - core.warning( - `Failed to copy file from ${sourcePath} to ${targetPath}: ${error}` - ); + if (sourcePath !== targetPath) { + try { + fs.copyFileSync(sourcePath, targetPath); + core.info(`Copied ${sourcePath} to ${targetPath}`); + } catch (error) { + core.warning( + `Failed to copy file from ${sourcePath} to ${targetPath}: ${error}` + ); + } } }