From 6d7172dabe9cbbe2ca951c523a331d600f62ac3c Mon Sep 17 00:00:00 2001 From: Aparna Jyothi Date: Thu, 19 Jun 2025 13:17:10 +0530 Subject: [PATCH] refactored the code --- dist/setup/index.js | 8 ++++---- src/setup-python.ts | 12 +++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index cb1f039f..19a5c017 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -96947,14 +96947,14 @@ function cacheDependencies(cache, pythonVersion) { // Copy file asynchronously yield fs_1.default.promises.copyFile(sourcePath, targetPath); core.info(`Copied ${sourcePath} to ${targetPath}`); + resolvedDependencyPath = path + .relative(workspace, targetPath) + .replace(/\\/g, '/'); + core.info(`Resolved cache-dependency-path: ${resolvedDependencyPath}`); } else { core.info(`Dependency file is already inside the workspace: ${sourcePath}`); } - resolvedDependencyPath = path - .relative(workspace, targetPath) - .replace(/\\/g, '/'); - core.info(`Resolved cache-dependency-path: ${resolvedDependencyPath}`); } } catch (error) { diff --git a/src/setup-python.ts b/src/setup-python.ts index 106b415a..ff98008b 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -53,16 +53,18 @@ export async function cacheDependencies(cache: string, pythonVersion: string) { // Copy file asynchronously await fs.promises.copyFile(sourcePath, targetPath); core.info(`Copied ${sourcePath} to ${targetPath}`); + + resolvedDependencyPath = path + .relative(workspace, targetPath) + .replace(/\\/g, '/'); + core.info( + `Resolved cache-dependency-path: ${resolvedDependencyPath}` + ); } else { core.info( `Dependency file is already inside the workspace: ${sourcePath}` ); } - - resolvedDependencyPath = path - .relative(workspace, targetPath) - .replace(/\\/g, '/'); - core.info(`Resolved cache-dependency-path: ${resolvedDependencyPath}`); } } catch (error) { core.warning(