mirror of
https://github.com/actions/setup-python.git
synced 2025-09-10 18:56:16 +00:00
Merge c33e178e6a
into 65b071217a
This commit is contained in:
commit
bdbd198b4c
5 changed files with 103 additions and 75 deletions
18
dist/setup/index.js
vendored
18
dist/setup/index.js
vendored
|
@ -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}`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue