diff --git a/README.md b/README.md index 18905fb..0da14ce 100644 --- a/README.md +++ b/README.md @@ -237,29 +237,6 @@ Artifacts are retained for 90 days by default. You can specify a shorter retenti The retention period must be between 1 and 90 inclusive. For more information see [artifact and log retention policies](https://docs.github.com/en/free-pro-team@latest/actions/reference/usage-limits-billing-and-administration#artifact-and-log-retention-policy). - -### Hidden Files - -By default, hidden files are ignored by this action to avoid unintentionally uploading sensitive information. - -In versions of this action before v3.2.0, these hidden files were included by default. - -If you need to upload hidden files, you can use the `include-hidden-files` input. - -```yaml -jobs: - upload: - runs-on: ubuntu-latest - steps: - - name: Create a Hidden File - run: echo "hello from a hidden file" > .hidden-file.txt - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - path: .hidden-file.txt - include-hidden-files: true -``` - ## Where does the upload go? At the bottom of the workflow summary page, there is a dedicated section for artifacts. Here's a screenshot of something you might see: diff --git a/__tests__/search.test.ts b/__tests__/search.test.ts index a2436cf..cbf54ac 100644 --- a/__tests__/search.test.ts +++ b/__tests__/search.test.ts @@ -61,20 +61,6 @@ const lonelyFilePath = path.join( 'lonely-file.txt' ) -const hiddenFile = path.join(root, '.hidden-file.txt') -const fileInHiddenFolderPath = path.join( - root, - '.hidden-folder', - 'folder-in-hidden-folder', - 'file.txt' -) -const fileInHiddenFolderInFolderA = path.join( - root, - 'folder-a', - '.hidden-folder-in-folder-a', - 'file.txt' -) - describe('Search', () => { beforeAll(async () => { // mock all output so that there is less noise when running tests @@ -106,13 +92,6 @@ describe('Search', () => { await fs.mkdir(path.join(root, 'folder-h', 'folder-j', 'folder-k'), { recursive: true }) - await fs.mkdir( - path.join(root, '.hidden-folder', 'folder-in-hidden-folder'), - {recursive: true} - ) - await fs.mkdir(path.join(root, 'folder-a', '.hidden-folder-in-folder-a'), { - recursive: true - }) await fs.writeFile(searchItem1Path, 'search item1 file') await fs.writeFile(searchItem2Path, 'search item2 file') @@ -131,19 +110,10 @@ describe('Search', () => { await fs.writeFile(amazingFileInFolderHPath, 'amazing file') await fs.writeFile(lonelyFilePath, 'all by itself') - - await fs.writeFile(hiddenFile, 'hidden file') - await fs.writeFile(fileInHiddenFolderPath, 'file in hidden directory') - await fs.writeFile(fileInHiddenFolderInFolderA, 'file in hidden directory') /* Directory structure of files that get created: root/ - .hidden-folder/ - folder-in-hidden-folder/ - file.txt folder-a/ - .hidden-folder-in-folder-a/ - file.txt folder-b/ folder-c/ search-item1.txt @@ -166,7 +136,6 @@ describe('Search', () => { folder-j/ folder-k/ lonely-file.txt - .hidden-file.txt search-item5.txt */ }) @@ -383,24 +352,4 @@ describe('Search', () => { ) expect(searchResult.filesToUpload.includes(lonelyFilePath)).toEqual(true) }) - - it('Hidden files ignored by default', async () => { - const searchPath = path.join(root, '**/*') - const searchResult = await findFilesToUpload(searchPath) - - expect(searchResult.filesToUpload).not.toContain(hiddenFile) - expect(searchResult.filesToUpload).not.toContain(fileInHiddenFolderPath) - expect(searchResult.filesToUpload).not.toContain( - fileInHiddenFolderInFolderA - ) - }) - - it('Hidden files included', async () => { - const searchPath = path.join(root, '**/*') - const searchResult = await findFilesToUpload(searchPath, true) - - expect(searchResult.filesToUpload).toContain(hiddenFile) - expect(searchResult.filesToUpload).toContain(fileInHiddenFolderPath) - expect(searchResult.filesToUpload).toContain(fileInHiddenFolderInFolderA) - }) }) diff --git a/action.yml b/action.yml index 47f4e66..219bf78 100644 --- a/action.yml +++ b/action.yml @@ -23,11 +23,6 @@ inputs: Minimum 1 day. Maximum 90 days unless changed from the repository settings page. - include-hidden-files: - description: > - If true, hidden files will be included in the uploaded artifact. - If false, hidden files will be excluded from the uploaded artifact. - default: 'false' runs: using: 'node20' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index b1b4b94..1a10574 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3276,18 +3276,16 @@ exports.create = create; * Computes the sha256 hash of a glob * * @param patterns Patterns separated by newlines - * @param currentWorkspace Workspace used when matching files * @param options Glob options - * @param verbose Enables verbose logging */ -function hashFiles(patterns, currentWorkspace = '', options, verbose = false) { +function hashFiles(patterns, options, verbose = false) { return __awaiter(this, void 0, void 0, function* () { let followSymbolicLinks = true; if (options && typeof options.followSymbolicLinks === 'boolean') { followSymbolicLinks = options.followSymbolicLinks; } const globber = yield create(patterns, { followSymbolicLinks }); - return (0, internal_hash_files_1.hashFiles)(globber, currentWorkspace, verbose); + return internal_hash_files_1.hashFiles(globber, verbose); }); } exports.hashFiles = hashFiles; @@ -3302,11 +3300,7 @@ exports.hashFiles = hashFiles; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -3319,7 +3313,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -3334,8 +3328,7 @@ function getOptions(copy) { followSymbolicLinks: true, implicitDescendants: true, matchDirectories: true, - omitBrokenSymbolicLinks: true, - excludeHiddenFiles: false + omitBrokenSymbolicLinks: true }; if (copy) { if (typeof copy.followSymbolicLinks === 'boolean') { @@ -3354,10 +3347,6 @@ function getOptions(copy) { result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks; core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`); } - if (typeof copy.excludeHiddenFiles === 'boolean') { - result.excludeHiddenFiles = copy.excludeHiddenFiles; - core.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`); - } } return result; } @@ -3373,11 +3362,7 @@ exports.getOptions = getOptions; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -3390,7 +3375,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -3444,21 +3429,19 @@ class DefaultGlobber { return this.searchPaths.slice(); } glob() { - var _a, e_1, _b, _c; + var e_1, _a; return __awaiter(this, void 0, void 0, function* () { const result = []; try { - for (var _d = true, _e = __asyncValues(this.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) { - _c = _f.value; - _d = false; - const itemPath = _c; + for (var _b = __asyncValues(this.globGenerator()), _c; _c = yield _b.next(), !_c.done;) { + const itemPath = _c.value; result.push(itemPath); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (!_d && !_a && (_b = _e.return)) yield _b.call(_e); + if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b); } finally { if (e_1) throw e_1.error; } } @@ -3516,10 +3499,6 @@ class DefaultGlobber { if (!stats) { continue; } - // Hidden file or directory? - if (options.excludeHiddenFiles && path.basename(item.path).match(/^\./)) { - continue; - } // Directory if (stats.isDirectory()) { // Matched @@ -3625,11 +3604,7 @@ exports.DefaultGlobber = DefaultGlobber; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -3642,7 +3617,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -3670,22 +3645,18 @@ const fs = __importStar(__nccwpck_require__(7147)); const stream = __importStar(__nccwpck_require__(2781)); const util = __importStar(__nccwpck_require__(3837)); const path = __importStar(__nccwpck_require__(1017)); -function hashFiles(globber, currentWorkspace, verbose = false) { - var _a, e_1, _b, _c; - var _d; +function hashFiles(globber, verbose = false) { + var e_1, _a; + var _b; return __awaiter(this, void 0, void 0, function* () { const writeDelegate = verbose ? core.info : core.debug; let hasMatch = false; - const githubWorkspace = currentWorkspace - ? currentWorkspace - : (_d = process.env['GITHUB_WORKSPACE']) !== null && _d !== void 0 ? _d : process.cwd(); + const githubWorkspace = (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd(); const result = crypto.createHash('sha256'); let count = 0; try { - for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) { - _c = _g.value; - _e = false; - const file = _c; + for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) { + const file = _d.value; writeDelegate(file); if (!file.startsWith(`${githubWorkspace}${path.sep}`)) { writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`); @@ -3708,7 +3679,7 @@ function hashFiles(globber, currentWorkspace, verbose = false) { catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (!_e && !_a && (_b = _f.return)) yield _b.call(_f); + if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c); } finally { if (e_1) throw e_1.error; } } @@ -3748,7 +3719,7 @@ var MatchKind; MatchKind[MatchKind["File"] = 2] = "File"; /** Matched */ MatchKind[MatchKind["All"] = 3] = "All"; -})(MatchKind || (exports.MatchKind = MatchKind = {})); +})(MatchKind = exports.MatchKind || (exports.MatchKind = {})); //# sourceMappingURL=internal-match-kind.js.map /***/ }), @@ -3760,11 +3731,7 @@ var MatchKind; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -3777,7 +3744,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -3827,8 +3794,8 @@ exports.dirname = dirname; * or `C:` are expanded based on the current working directory. */ function ensureAbsoluteRoot(root, itemPath) { - (0, assert_1.default)(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); - (0, assert_1.default)(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); + assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); + assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); // Already rooted if (hasAbsoluteRoot(itemPath)) { return itemPath; @@ -3838,7 +3805,7 @@ function ensureAbsoluteRoot(root, itemPath) { // Check for itemPath like C: or C:foo if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) { let cwd = process.cwd(); - (0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); + assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); // Drive letter matches cwd? Expand to cwd if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) { // Drive only, e.g. C: @@ -3863,11 +3830,11 @@ function ensureAbsoluteRoot(root, itemPath) { // Check for itemPath like \ or \foo else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) { const cwd = process.cwd(); - (0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); + assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); return `${cwd[0]}:\\${itemPath.substr(1)}`; } } - (0, assert_1.default)(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); + assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); // Otherwise ensure root ends with a separator if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) { // Intentionally empty @@ -3884,7 +3851,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot; * `\\hello\share` and `C:\hello` (and using alternate separator). */ function hasAbsoluteRoot(itemPath) { - (0, assert_1.default)(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); + assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); // Normalize separators itemPath = normalizeSeparators(itemPath); // Windows @@ -3901,7 +3868,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot; * `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator). */ function hasRoot(itemPath) { - (0, assert_1.default)(itemPath, `isRooted parameter 'itemPath' must not be empty`); + assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`); // Normalize separators itemPath = normalizeSeparators(itemPath); // Windows @@ -3969,11 +3936,7 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -3986,7 +3949,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -4011,7 +3974,7 @@ class Path { this.segments = []; // String if (typeof itemPath === 'string') { - (0, assert_1.default)(itemPath, `Parameter 'itemPath' must not be empty`); + assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`); // Normalize slashes and trim unnecessary trailing slash itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); // Not rooted @@ -4038,24 +4001,24 @@ class Path { // Array else { // Must not be empty - (0, assert_1.default)(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`); + assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`); // Each segment for (let i = 0; i < itemPath.length; i++) { let segment = itemPath[i]; // Must not be empty - (0, assert_1.default)(segment, `Parameter 'itemPath' must not contain any empty segments`); + assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`); // Normalize slashes segment = pathHelper.normalizeSeparators(itemPath[i]); // Root segment if (i === 0 && pathHelper.hasRoot(segment)) { segment = pathHelper.safeTrimTrailingSeparator(segment); - (0, assert_1.default)(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); + assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); this.segments.push(segment); } // All other segments else { // Must not contain slash - (0, assert_1.default)(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); + assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); this.segments.push(segment); } } @@ -4093,11 +4056,7 @@ exports.Path = Path; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -4110,7 +4069,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -4198,11 +4157,7 @@ exports.partialMatch = partialMatch; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -4215,7 +4170,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -4247,9 +4202,9 @@ class Pattern { else { // Convert to pattern segments = segments || []; - (0, assert_1.default)(segments.length, `Parameter 'segments' must not empty`); + assert_1.default(segments.length, `Parameter 'segments' must not empty`); const root = Pattern.getLiteral(segments[0]); - (0, assert_1.default)(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`); + assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`); pattern = new internal_path_1.Path(segments).toString().trim(); if (patternOrNegate) { pattern = `!${pattern}`; @@ -4343,13 +4298,13 @@ class Pattern { */ static fixupPattern(pattern, homedir) { // Empty - (0, assert_1.default)(pattern, 'pattern cannot be empty'); + assert_1.default(pattern, 'pattern cannot be empty'); // Must not contain `.` segment, unless first segment // Must not contain `..` segment const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x)); - (0, assert_1.default)(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); + assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); // Must not contain globs in root, e.g. Windows UNC path \\foo\b*r - (0, assert_1.default)(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); + assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); // Normalize slashes pattern = pathHelper.normalizeSeparators(pattern); // Replace leading `.` segment @@ -4359,8 +4314,8 @@ class Pattern { // Replace leading `~` segment else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) { homedir = homedir || os.homedir(); - (0, assert_1.default)(homedir, 'Unable to determine HOME directory'); - (0, assert_1.default)(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); + assert_1.default(homedir, 'Unable to determine HOME directory'); + assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); pattern = Pattern.globEscape(homedir) + pattern.substr(1); } // Replace relative drive root, e.g. pattern is C: or C:foo @@ -10790,7 +10745,6 @@ var Inputs; Inputs["Path"] = "path"; Inputs["IfNoFilesFound"] = "if-no-files-found"; Inputs["RetentionDays"] = "retention-days"; - Inputs["IncludeHiddenFiles"] = "include-hidden-files"; })(Inputs = exports.Inputs || (exports.Inputs = {})); var NoFileOptions; (function (NoFileOptions) { @@ -10851,15 +10805,13 @@ function getInputs() { const path = core.getInput(constants_1.Inputs.Path, { required: true }); const ifNoFilesFound = core.getInput(constants_1.Inputs.IfNoFilesFound); const noFileBehavior = constants_1.NoFileOptions[ifNoFilesFound]; - const includeHiddenFiles = core.getBooleanInput(constants_1.Inputs.IncludeHiddenFiles); if (!noFileBehavior) { core.setFailed(`Unrecognized ${constants_1.Inputs.IfNoFilesFound} input. Provided: ${ifNoFilesFound}. Available options: ${Object.keys(constants_1.NoFileOptions)}`); } const inputs = { artifactName: name, searchPath: path, - ifNoFilesFound: noFileBehavior, - includeHiddenFiles + ifNoFilesFound: noFileBehavior }; const retentionDaysStr = core.getInput(constants_1.Inputs.RetentionDays); if (retentionDaysStr) { @@ -10921,12 +10873,11 @@ const fs_1 = __nccwpck_require__(7147); const path_1 = __nccwpck_require__(1017); const util_1 = __nccwpck_require__(3837); const stats = (0, util_1.promisify)(fs_1.stat); -function getDefaultGlobOptions(includeHiddenFiles) { +function getDefaultGlobOptions() { return { followSymbolicLinks: true, implicitDescendants: true, - omitBrokenSymbolicLinks: true, - excludeHiddenFiles: !includeHiddenFiles + omitBrokenSymbolicLinks: true }; } /** @@ -10980,10 +10931,10 @@ function getMultiPathLCA(searchPaths) { } return path.join(...commonPaths); } -function findFilesToUpload(searchPath, includeHiddenFiles) { +function findFilesToUpload(searchPath, globOptions) { return __awaiter(this, void 0, void 0, function* () { const searchResults = []; - const globber = yield glob.create(searchPath, getDefaultGlobOptions(includeHiddenFiles || false)); + const globber = yield glob.create(searchPath, globOptions || getDefaultGlobOptions()); const rawSearchResults = yield globber.glob(); /* Files are saved with case insensitivity. Uploading both a.txt and A.txt will files to be overwritten @@ -11091,7 +11042,7 @@ function run() { return __awaiter(this, void 0, void 0, function* () { try { const inputs = (0, input_helper_1.getInputs)(); - const searchResult = yield (0, search_1.findFilesToUpload)(inputs.searchPath, inputs.includeHiddenFiles); + const searchResult = yield (0, search_1.findFilesToUpload)(inputs.searchPath); if (searchResult.filesToUpload.length === 0) { // No files were found, different use cases warrant different types of behavior if nothing is found switch (inputs.ifNoFilesFound) { diff --git a/package-lock.json b/package-lock.json index 5f55fa2..2384508 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@actions/artifact": "^1.1.2", "@actions/core": "^1.10.0", - "@actions/glob": "^0.5.0", + "@actions/glob": "^0.3.0", "@actions/io": "^1.1.2" }, "devDependencies": { @@ -52,11 +52,11 @@ } }, "node_modules/@actions/glob": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.0.tgz", - "integrity": "sha512-tST2rjPvJLRZLuT9NMUtyBjvj9Yo0MiJS3ow004slMvm8GFM+Zv9HvMJ7HWzfUyJnGrJvDsYkWBaaG3YKXRtCw==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.3.0.tgz", + "integrity": "sha512-tJP1ZhF87fd6LBnaXWlahkyvdgvsLl7WnreW1EZaC8JWjpMXmzqWzQVe/IEYslrkT9ymibVrKyJN4UMD7uQM2w==", "dependencies": { - "@actions/core": "^1.9.1", + "@actions/core": "^1.2.6", "minimatch": "^3.0.4" } }, @@ -6168,11 +6168,11 @@ } }, "@actions/glob": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.0.tgz", - "integrity": "sha512-tST2rjPvJLRZLuT9NMUtyBjvj9Yo0MiJS3ow004slMvm8GFM+Zv9HvMJ7HWzfUyJnGrJvDsYkWBaaG3YKXRtCw==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.3.0.tgz", + "integrity": "sha512-tJP1ZhF87fd6LBnaXWlahkyvdgvsLl7WnreW1EZaC8JWjpMXmzqWzQVe/IEYslrkT9ymibVrKyJN4UMD7uQM2w==", "requires": { - "@actions/core": "^1.9.1", + "@actions/core": "^1.2.6", "minimatch": "^3.0.4" } }, diff --git a/package.json b/package.json index 2aa0c46..92d6219 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "dependencies": { "@actions/artifact": "^1.1.2", "@actions/core": "^1.10.0", - "@actions/glob": "^0.5.0", + "@actions/glob": "^0.3.0", "@actions/io": "^1.1.2" }, "devDependencies": { diff --git a/src/constants.ts b/src/constants.ts index 7fb2010..9d64a61 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -3,8 +3,7 @@ export enum Inputs { Name = 'name', Path = 'path', IfNoFilesFound = 'if-no-files-found', - RetentionDays = 'retention-days', - IncludeHiddenFiles = 'include-hidden-files' + RetentionDays = 'retention-days' } export enum NoFileOptions { diff --git a/src/input-helper.ts b/src/input-helper.ts index 26fa165..8344823 100644 --- a/src/input-helper.ts +++ b/src/input-helper.ts @@ -11,7 +11,6 @@ export function getInputs(): UploadInputs { const ifNoFilesFound = core.getInput(Inputs.IfNoFilesFound) const noFileBehavior: NoFileOptions = NoFileOptions[ifNoFilesFound] - const includeHiddenFiles = core.getBooleanInput(Inputs.IncludeHiddenFiles) if (!noFileBehavior) { core.setFailed( @@ -26,8 +25,7 @@ export function getInputs(): UploadInputs { const inputs = { artifactName: name, searchPath: path, - ifNoFilesFound: noFileBehavior, - includeHiddenFiles + ifNoFilesFound: noFileBehavior } as UploadInputs const retentionDaysStr = core.getInput(Inputs.RetentionDays) diff --git a/src/search.ts b/src/search.ts index e573f83..bd80164 100644 --- a/src/search.ts +++ b/src/search.ts @@ -11,12 +11,11 @@ export interface SearchResult { rootDirectory: string } -function getDefaultGlobOptions(includeHiddenFiles: boolean): glob.GlobOptions { +function getDefaultGlobOptions(): glob.GlobOptions { return { followSymbolicLinks: true, implicitDescendants: true, - omitBrokenSymbolicLinks: true, - excludeHiddenFiles: !includeHiddenFiles + omitBrokenSymbolicLinks: true } } @@ -81,12 +80,12 @@ function getMultiPathLCA(searchPaths: string[]): string { export async function findFilesToUpload( searchPath: string, - includeHiddenFiles?: boolean + globOptions?: glob.GlobOptions ): Promise { const searchResults: string[] = [] const globber = await glob.create( searchPath, - getDefaultGlobOptions(includeHiddenFiles || false) + globOptions || getDefaultGlobOptions() ) const rawSearchResults: string[] = await globber.glob() diff --git a/src/upload-artifact.ts b/src/upload-artifact.ts index 7ecd60b..44c74bf 100644 --- a/src/upload-artifact.ts +++ b/src/upload-artifact.ts @@ -7,10 +7,7 @@ import {NoFileOptions} from './constants' async function run(): Promise { try { const inputs = getInputs() - const searchResult = await findFilesToUpload( - inputs.searchPath, - inputs.includeHiddenFiles - ) + const searchResult = await findFilesToUpload(inputs.searchPath) if (searchResult.filesToUpload.length === 0) { // No files were found, different use cases warrant different types of behavior if nothing is found switch (inputs.ifNoFilesFound) { diff --git a/src/upload-inputs.ts b/src/upload-inputs.ts index 6a033c9..37325df 100644 --- a/src/upload-inputs.ts +++ b/src/upload-inputs.ts @@ -20,9 +20,4 @@ export interface UploadInputs { * Duration after which artifact will expire in days */ retentionDays: number - - /** - * Whether or not to include hidden files in the artifact - */ - includeHiddenFiles: boolean }