This commit is contained in:
aparnajyothi-y 2025-08-26 18:54:01 +02:00 committed by GitHub
commit bdbd198b4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 103 additions and 75 deletions

18
dist/setup/index.js vendored
View file

@ -97955,6 +97955,7 @@ function cacheDependencies(cache, pythonVersion) {
return __awaiter(this, void 0, void 0, function* () {
const cacheDependencyPath = core.getInput('cache-dependency-path') || undefined;
let resolvedDependencyPath = undefined;
const overwrite = core.getBooleanInput('overwrite', { required: false });
if (cacheDependencyPath) {
const actionPath = process.env.GITHUB_ACTION_PATH || '';
const workspace = process.env.GITHUB_WORKSPACE || process.cwd();
@ -97972,11 +97973,20 @@ function cacheDependencies(cache, pythonVersion) {
else {
if (sourcePath !== targetPath) {
const targetDir = path.dirname(targetPath);
// Create target directory if it doesn't exist
yield fs_1.default.promises.mkdir(targetDir, { recursive: true });
// Copy file asynchronously
yield fs_1.default.promises.copyFile(sourcePath, targetPath);
core.info(`Copied ${sourcePath} to ${targetPath}`);
const targetExists = yield fs_1.default.promises
.access(targetPath, fs_1.default.constants.F_OK)
.then(() => true)
.catch(() => false);
if (targetExists && !overwrite) {
const filename = path.basename(cacheDependencyPath);
core.warning(`A file named '${filename}' exists in both the composite action and the workspace. The file in the workspace will be used. To avoid ambiguity, consider renaming one of the files or setting 'overwrite: true'.`);
core.info(`Skipped copying ${sourcePath} — target already exists at ${targetPath}`);
}
else {
yield fs_1.default.promises.copyFile(sourcePath, targetPath);
core.info(`${targetExists ? 'Overwrote' : 'Copied'} ${sourcePath} to ${targetPath}`);
}
}
else {
core.info(`Dependency file is already inside the workspace: ${sourcePath}`);