Exclude hidden files by default

This commit is contained in:
Josh Gross
2024-08-15 16:22:09 -04:00
parent 834a144ee9
commit cb6558bb10
18 changed files with 169 additions and 36 deletions

16
dist/upload/index.js vendored
View File

@ -125757,11 +125757,12 @@ const fs_1 = __nccwpck_require__(57147);
const path_1 = __nccwpck_require__(71017);
const util_1 = __nccwpck_require__(73837);
const stats = (0, util_1.promisify)(fs_1.stat);
function getDefaultGlobOptions() {
function getDefaultGlobOptions(_includeHiddenFiles) {
return {
followSymbolicLinks: true,
implicitDescendants: true,
omitBrokenSymbolicLinks: true
omitBrokenSymbolicLinks: true,
// excludeHiddenFiles: !includeHiddenFiles,
};
}
/**
@ -125815,10 +125816,10 @@ function getMultiPathLCA(searchPaths) {
}
return path.join(...commonPaths);
}
function findFilesToUpload(searchPath, globOptions) {
function findFilesToUpload(searchPath, includeHiddenFiles) {
return __awaiter(this, void 0, void 0, function* () {
const searchResults = [];
const globber = yield glob.create(searchPath, globOptions || getDefaultGlobOptions());
const globber = yield glob.create(searchPath, getDefaultGlobOptions(includeHiddenFiles || false));
const rawSearchResults = yield globber.glob();
/*
Files are saved with case insensitivity. Uploading both a.txt and A.txt will files to be overwritten
@ -125956,6 +125957,7 @@ var Inputs;
Inputs["RetentionDays"] = "retention-days";
Inputs["CompressionLevel"] = "compression-level";
Inputs["Overwrite"] = "overwrite";
Inputs["IncludeHiddenFiles"] = "include-hidden-files";
})(Inputs = exports.Inputs || (exports.Inputs = {}));
var NoFileOptions;
(function (NoFileOptions) {
@ -126053,6 +126055,7 @@ function getInputs() {
const name = core.getInput(constants_1.Inputs.Name);
const path = core.getInput(constants_1.Inputs.Path, { required: true });
const overwrite = core.getBooleanInput(constants_1.Inputs.Overwrite);
const includeHiddenFiles = core.getBooleanInput(constants_1.Inputs.IncludeHiddenFiles);
const ifNoFilesFound = core.getInput(constants_1.Inputs.IfNoFilesFound);
const noFileBehavior = constants_1.NoFileOptions[ifNoFilesFound];
if (!noFileBehavior) {
@ -126062,7 +126065,8 @@ function getInputs() {
artifactName: name,
searchPath: path,
ifNoFilesFound: noFileBehavior,
overwrite: overwrite
overwrite: overwrite,
includeHiddenFiles: includeHiddenFiles,
};
const retentionDaysStr = core.getInput(constants_1.Inputs.RetentionDays);
if (retentionDaysStr) {
@ -126151,7 +126155,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, inputs.includeHiddenFiles);
if (searchResult.filesToUpload.length === 0) {
// No files were found, different use cases warrant different types of behavior if nothing is found
switch (inputs.ifNoFilesFound) {