|
|
|
@ -3276,16 +3276,18 @@ 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, options, verbose = false) {
|
|
|
|
|
function hashFiles(patterns, currentWorkspace = '', 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 internal_hash_files_1.hashFiles(globber, verbose);
|
|
|
|
|
return (0, internal_hash_files_1.hashFiles)(globber, currentWorkspace, verbose);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
exports.hashFiles = hashFiles;
|
|
|
|
@ -3300,7 +3302,11 @@ exports.hashFiles = hashFiles;
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
@ -3313,7 +3319,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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
@ -3328,7 +3334,8 @@ function getOptions(copy) {
|
|
|
|
|
followSymbolicLinks: true,
|
|
|
|
|
implicitDescendants: true,
|
|
|
|
|
matchDirectories: true,
|
|
|
|
|
omitBrokenSymbolicLinks: true
|
|
|
|
|
omitBrokenSymbolicLinks: true,
|
|
|
|
|
excludeHiddenFiles: false
|
|
|
|
|
};
|
|
|
|
|
if (copy) {
|
|
|
|
|
if (typeof copy.followSymbolicLinks === 'boolean') {
|
|
|
|
@ -3347,6 +3354,10 @@ 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;
|
|
|
|
|
}
|
|
|
|
@ -3362,7 +3373,11 @@ exports.getOptions = getOptions;
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
@ -3375,7 +3390,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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
@ -3429,19 +3444,21 @@ class DefaultGlobber {
|
|
|
|
|
return this.searchPaths.slice();
|
|
|
|
|
}
|
|
|
|
|
glob() {
|
|
|
|
|
var e_1, _a;
|
|
|
|
|
var _a, e_1, _b, _c;
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const result = [];
|
|
|
|
|
try {
|
|
|
|
|
for (var _b = __asyncValues(this.globGenerator()), _c; _c = yield _b.next(), !_c.done;) {
|
|
|
|
|
const itemPath = _c.value;
|
|
|
|
|
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;
|
|
|
|
|
result.push(itemPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
|
|
|
finally {
|
|
|
|
|
try {
|
|
|
|
|
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
|
|
|
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
|
|
|
|
|
}
|
|
|
|
|
finally { if (e_1) throw e_1.error; }
|
|
|
|
|
}
|
|
|
|
@ -3499,6 +3516,10 @@ class DefaultGlobber {
|
|
|
|
|
if (!stats) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// Hidden file or directory?
|
|
|
|
|
if (options.excludeHiddenFiles && path.basename(item.path).match(/^\./)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// Directory
|
|
|
|
|
if (stats.isDirectory()) {
|
|
|
|
|
// Matched
|
|
|
|
@ -3604,7 +3625,11 @@ exports.DefaultGlobber = DefaultGlobber;
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
@ -3617,7 +3642,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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
@ -3645,18 +3670,22 @@ 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, verbose = false) {
|
|
|
|
|
var e_1, _a;
|
|
|
|
|
var _b;
|
|
|
|
|
function hashFiles(globber, currentWorkspace, verbose = false) {
|
|
|
|
|
var _a, e_1, _b, _c;
|
|
|
|
|
var _d;
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const writeDelegate = verbose ? core.info : core.debug;
|
|
|
|
|
let hasMatch = false;
|
|
|
|
|
const githubWorkspace = (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd();
|
|
|
|
|
const githubWorkspace = currentWorkspace
|
|
|
|
|
? currentWorkspace
|
|
|
|
|
: (_d = process.env['GITHUB_WORKSPACE']) !== null && _d !== void 0 ? _d : process.cwd();
|
|
|
|
|
const result = crypto.createHash('sha256');
|
|
|
|
|
let count = 0;
|
|
|
|
|
try {
|
|
|
|
|
for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) {
|
|
|
|
|
const file = _d.value;
|
|
|
|
|
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;
|
|
|
|
|
writeDelegate(file);
|
|
|
|
|
if (!file.startsWith(`${githubWorkspace}${path.sep}`)) {
|
|
|
|
|
writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`);
|
|
|
|
@ -3679,7 +3708,7 @@ function hashFiles(globber, verbose = false) {
|
|
|
|
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
|
|
|
finally {
|
|
|
|
|
try {
|
|
|
|
|
if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c);
|
|
|
|
|
if (!_e && !_a && (_b = _f.return)) yield _b.call(_f);
|
|
|
|
|
}
|
|
|
|
|
finally { if (e_1) throw e_1.error; }
|
|
|
|
|
}
|
|
|
|
@ -3719,7 +3748,7 @@ var MatchKind;
|
|
|
|
|
MatchKind[MatchKind["File"] = 2] = "File";
|
|
|
|
|
/** Matched */
|
|
|
|
|
MatchKind[MatchKind["All"] = 3] = "All";
|
|
|
|
|
})(MatchKind = exports.MatchKind || (exports.MatchKind = {}));
|
|
|
|
|
})(MatchKind || (exports.MatchKind = MatchKind = {}));
|
|
|
|
|
//# sourceMappingURL=internal-match-kind.js.map
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
@ -3731,7 +3760,11 @@ var MatchKind;
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
@ -3744,7 +3777,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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
@ -3794,8 +3827,8 @@ exports.dirname = dirname;
|
|
|
|
|
* or `C:` are expanded based on the current working directory.
|
|
|
|
|
*/
|
|
|
|
|
function ensureAbsoluteRoot(root, itemPath) {
|
|
|
|
|
assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
|
|
|
|
|
assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
|
|
|
|
|
(0, assert_1.default)(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
|
|
|
|
|
(0, assert_1.default)(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
|
|
|
|
|
// Already rooted
|
|
|
|
|
if (hasAbsoluteRoot(itemPath)) {
|
|
|
|
|
return itemPath;
|
|
|
|
@ -3805,7 +3838,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();
|
|
|
|
|
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
|
|
|
|
|
(0, 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:
|
|
|
|
@ -3830,11 +3863,11 @@ function ensureAbsoluteRoot(root, itemPath) {
|
|
|
|
|
// Check for itemPath like \ or \foo
|
|
|
|
|
else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
|
|
|
|
|
const cwd = process.cwd();
|
|
|
|
|
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
|
|
|
|
|
(0, 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)}`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
|
|
|
|
|
(0, 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
|
|
|
|
@ -3851,7 +3884,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot;
|
|
|
|
|
* `\\hello\share` and `C:\hello` (and using alternate separator).
|
|
|
|
|
*/
|
|
|
|
|
function hasAbsoluteRoot(itemPath) {
|
|
|
|
|
assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
|
|
|
|
|
(0, assert_1.default)(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
|
|
|
|
|
// Normalize separators
|
|
|
|
|
itemPath = normalizeSeparators(itemPath);
|
|
|
|
|
// Windows
|
|
|
|
@ -3868,7 +3901,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot;
|
|
|
|
|
* `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator).
|
|
|
|
|
*/
|
|
|
|
|
function hasRoot(itemPath) {
|
|
|
|
|
assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`);
|
|
|
|
|
(0, assert_1.default)(itemPath, `isRooted parameter 'itemPath' must not be empty`);
|
|
|
|
|
// Normalize separators
|
|
|
|
|
itemPath = normalizeSeparators(itemPath);
|
|
|
|
|
// Windows
|
|
|
|
@ -3936,7 +3969,11 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator;
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
@ -3949,7 +3986,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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
@ -3974,7 +4011,7 @@ class Path {
|
|
|
|
|
this.segments = [];
|
|
|
|
|
// String
|
|
|
|
|
if (typeof itemPath === 'string') {
|
|
|
|
|
assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`);
|
|
|
|
|
(0, assert_1.default)(itemPath, `Parameter 'itemPath' must not be empty`);
|
|
|
|
|
// Normalize slashes and trim unnecessary trailing slash
|
|
|
|
|
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
|
|
|
|
|
// Not rooted
|
|
|
|
@ -4001,24 +4038,24 @@ class Path {
|
|
|
|
|
// Array
|
|
|
|
|
else {
|
|
|
|
|
// Must not be empty
|
|
|
|
|
assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
|
|
|
|
|
(0, 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
|
|
|
|
|
assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`);
|
|
|
|
|
(0, 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);
|
|
|
|
|
assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
|
|
|
|
|
(0, 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
|
|
|
|
|
assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
|
|
|
|
|
(0, assert_1.default)(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
|
|
|
|
|
this.segments.push(segment);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -4056,7 +4093,11 @@ exports.Path = Path;
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
@ -4069,7 +4110,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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
@ -4157,7 +4198,11 @@ exports.partialMatch = partialMatch;
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
@ -4170,7 +4215,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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
@ -4202,9 +4247,9 @@ class Pattern {
|
|
|
|
|
else {
|
|
|
|
|
// Convert to pattern
|
|
|
|
|
segments = segments || [];
|
|
|
|
|
assert_1.default(segments.length, `Parameter 'segments' must not empty`);
|
|
|
|
|
(0, assert_1.default)(segments.length, `Parameter 'segments' must not empty`);
|
|
|
|
|
const root = Pattern.getLiteral(segments[0]);
|
|
|
|
|
assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
|
|
|
|
|
(0, 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}`;
|
|
|
|
@ -4298,13 +4343,13 @@ class Pattern {
|
|
|
|
|
*/
|
|
|
|
|
static fixupPattern(pattern, homedir) {
|
|
|
|
|
// Empty
|
|
|
|
|
assert_1.default(pattern, 'pattern cannot be empty');
|
|
|
|
|
(0, 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));
|
|
|
|
|
assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
|
|
|
|
|
(0, 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
|
|
|
|
|
assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
|
|
|
|
|
(0, 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
|
|
|
|
@ -4314,8 +4359,8 @@ class Pattern {
|
|
|
|
|
// Replace leading `~` segment
|
|
|
|
|
else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) {
|
|
|
|
|
homedir = homedir || os.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}'`);
|
|
|
|
|
(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}'`);
|
|
|
|
|
pattern = Pattern.globEscape(homedir) + pattern.substr(1);
|
|
|
|
|
}
|
|
|
|
|
// Replace relative drive root, e.g. pattern is C: or C:foo
|
|
|
|
@ -10745,6 +10790,7 @@ 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) {
|
|
|
|
@ -10805,13 +10851,15 @@ 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
|
|
|
|
|
ifNoFilesFound: noFileBehavior,
|
|
|
|
|
includeHiddenFiles
|
|
|
|
|
};
|
|
|
|
|
const retentionDaysStr = core.getInput(constants_1.Inputs.RetentionDays);
|
|
|
|
|
if (retentionDaysStr) {
|
|
|
|
@ -10873,11 +10921,12 @@ 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() {
|
|
|
|
|
function getDefaultGlobOptions(includeHiddenFiles) {
|
|
|
|
|
return {
|
|
|
|
|
followSymbolicLinks: true,
|
|
|
|
|
implicitDescendants: true,
|
|
|
|
|
omitBrokenSymbolicLinks: true
|
|
|
|
|
omitBrokenSymbolicLinks: true,
|
|
|
|
|
excludeHiddenFiles: !includeHiddenFiles
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
@ -10931,10 +10980,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
|
|
|
|
|