add follow symbolic links options

This commit is contained in:
Pepe Franco 2024-03-15 16:27:05 +11:00
parent ef09cdac3e
commit 264caab452
No known key found for this signature in database
GPG key ID: E08F34018F21BD9C
10 changed files with 133 additions and 7 deletions

7
dist/merge/index.js vendored
View file

@ -129675,7 +129675,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.findFilesToUpload = void 0;
exports.findFilesToUpload = exports.getGlobOptions = void 0;
const glob = __importStar(__nccwpck_require__(28090));
const path = __importStar(__nccwpck_require__(71017));
const core_1 = __nccwpck_require__(42186);
@ -129690,6 +129690,10 @@ function getDefaultGlobOptions() {
omitBrokenSymbolicLinks: true
};
}
function getGlobOptions(followSymbolicLinks) {
return Object.assign({ followSymbolicLinks }, getDefaultGlobOptions());
}
exports.getGlobOptions = getGlobOptions;
/**
* If multiple paths are specific, the least common ancestor (LCA) of the search paths is used as
* the delimiter to control the directory structure for the artifact. This function returns the LCA
@ -129746,6 +129750,7 @@ function findFilesToUpload(searchPath, globOptions) {
const searchResults = [];
const globber = yield glob.create(searchPath, globOptions || getDefaultGlobOptions());
const rawSearchResults = yield globber.glob();
console.log(rawSearchResults);
/*
Files are saved with case insensitivity. Uploading both a.txt and A.txt will files to be overwritten
Detect any files that could be overwritten for user awareness

12
dist/upload/index.js vendored
View file

@ -129433,7 +129433,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.findFilesToUpload = void 0;
exports.findFilesToUpload = exports.getGlobOptions = void 0;
const glob = __importStar(__nccwpck_require__(28090));
const path = __importStar(__nccwpck_require__(71017));
const core_1 = __nccwpck_require__(42186);
@ -129448,6 +129448,10 @@ function getDefaultGlobOptions() {
omitBrokenSymbolicLinks: true
};
}
function getGlobOptions(followSymbolicLinks) {
return Object.assign({ followSymbolicLinks }, getDefaultGlobOptions());
}
exports.getGlobOptions = getGlobOptions;
/**
* If multiple paths are specific, the least common ancestor (LCA) of the search paths is used as
* the delimiter to control the directory structure for the artifact. This function returns the LCA
@ -129504,6 +129508,7 @@ function findFilesToUpload(searchPath, globOptions) {
const searchResults = [];
const globber = yield glob.create(searchPath, globOptions || getDefaultGlobOptions());
const rawSearchResults = yield globber.glob();
console.log(rawSearchResults);
/*
Files are saved with case insensitivity. Uploading both a.txt and A.txt will files to be overwritten
Detect any files that could be overwritten for user awareness
@ -129637,6 +129642,7 @@ var Inputs;
Inputs["Name"] = "name";
Inputs["Path"] = "path";
Inputs["IfNoFilesFound"] = "if-no-files-found";
Inputs["FollowSymbolicLinks"] = "follow-symbolic-links";
Inputs["RetentionDays"] = "retention-days";
Inputs["CompressionLevel"] = "compression-level";
Inputs["Overwrite"] = "overwrite";
@ -129739,6 +129745,7 @@ function getInputs() {
const overwrite = core.getBooleanInput(constants_1.Inputs.Overwrite);
const ifNoFilesFound = core.getInput(constants_1.Inputs.IfNoFilesFound);
const noFileBehavior = constants_1.NoFileOptions[ifNoFilesFound];
const followSymbolicLinks = core.getBooleanInput(constants_1.Inputs.FollowSymbolicLinks);
if (!noFileBehavior) {
core.setFailed(`Unrecognized ${constants_1.Inputs.IfNoFilesFound} input. Provided: ${ifNoFilesFound}. Available options: ${Object.keys(constants_1.NoFileOptions)}`);
}
@ -129746,6 +129753,7 @@ function getInputs() {
artifactName: name,
searchPath: path,
ifNoFilesFound: noFileBehavior,
followSymbolicLinks: followSymbolicLinks,
overwrite: overwrite
};
const retentionDaysStr = core.getInput(constants_1.Inputs.RetentionDays);
@ -129835,7 +129843,7 @@ function deleteArtifactIfExists(artifactName) {
function run() {
return __awaiter(this, void 0, void 0, function* () {
const inputs = (0, input_helper_1.getInputs)();
const searchResult = yield (0, search_1.findFilesToUpload)(inputs.searchPath);
const searchResult = yield (0, search_1.findFilesToUpload)(inputs.searchPath, (0, search_1.getGlobOptions)(inputs.followSymbolicLinks));
if (searchResult.filesToUpload.length === 0) {
// No files were found, different use cases warrant different types of behavior if nothing is found
switch (inputs.ifNoFilesFound) {