diff --git a/lib/entry-points.js b/lib/entry-points.js index 8d51fab4c..8f9769bba 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -213,7 +213,7 @@ var require_file_command = __commonJS({ exports2.issueFileCommand = issueFileCommand; exports2.prepareKeyValueMessage = prepareKeyValueMessage; var crypto3 = __importStar2(require("crypto")); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var os8 = __importStar2(require("os")); var utils_1 = require_utils(); function issueFileCommand(command, message) { @@ -221,10 +221,10 @@ var require_file_command = __commonJS({ if (!filePath) { throw new Error(`Unable to find environment variable for file command ${command}`); } - if (!fs33.existsSync(filePath)) { + if (!fs34.existsSync(filePath)) { throw new Error(`Missing file at path: ${filePath}`); } - fs33.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os8.EOL}`, { + fs34.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os8.EOL}`, { encoding: "utf8" }); } @@ -28154,13 +28154,13 @@ var require_io_util = __commonJS({ exports2.isRooted = isRooted; exports2.tryGetExecutablePath = tryGetExecutablePath; exports2.getCmdPath = getCmdPath; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var path30 = __importStar2(require("path")); - _a6 = fs33.promises, exports2.chmod = _a6.chmod, exports2.copyFile = _a6.copyFile, exports2.lstat = _a6.lstat, exports2.mkdir = _a6.mkdir, exports2.open = _a6.open, exports2.readdir = _a6.readdir, exports2.rename = _a6.rename, exports2.rm = _a6.rm, exports2.rmdir = _a6.rmdir, exports2.stat = _a6.stat, exports2.symlink = _a6.symlink, exports2.unlink = _a6.unlink; + _a6 = fs34.promises, exports2.chmod = _a6.chmod, exports2.copyFile = _a6.copyFile, exports2.lstat = _a6.lstat, exports2.mkdir = _a6.mkdir, exports2.open = _a6.open, exports2.readdir = _a6.readdir, exports2.rename = _a6.rename, exports2.rm = _a6.rm, exports2.rmdir = _a6.rmdir, exports2.stat = _a6.stat, exports2.symlink = _a6.symlink, exports2.unlink = _a6.unlink; exports2.IS_WINDOWS = process.platform === "win32"; function readlink(fsPath) { return __awaiter2(this, void 0, void 0, function* () { - const result = yield fs33.promises.readlink(fsPath); + const result = yield fs34.promises.readlink(fsPath); if (exports2.IS_WINDOWS && !result.endsWith("\\")) { return `${result}\\`; } @@ -28168,7 +28168,7 @@ var require_io_util = __commonJS({ }); } exports2.UV_FS_O_EXLOCK = 268435456; - exports2.READONLY = fs33.constants.O_RDONLY; + exports2.READONLY = fs34.constants.O_RDONLY; function exists(fsPath) { return __awaiter2(this, void 0, void 0, function* () { try { @@ -34999,7 +34999,7 @@ var require_coerce = __commonJS({ var SemVer = require_semver(); var parse4 = require_parse2(); var { safeRe: re, t } = require_re(); - var coerce3 = (version, options) => { + var coerce4 = (version, options) => { if (version instanceof SemVer) { return version; } @@ -35034,7 +35034,7 @@ var require_coerce = __commonJS({ const build2 = options.includePrerelease && match2[6] ? `+${match2[6]}` : ""; return parse4(`${major}.${minor}.${patch}${prerelease}${build2}`, options); }; - module2.exports = coerce3; + module2.exports = coerce4; } }); @@ -36120,7 +36120,7 @@ var require_semver2 = __commonJS({ var gte7 = require_gte(); var lte2 = require_lte(); var cmp = require_cmp(); - var coerce3 = require_coerce(); + var coerce4 = require_coerce(); var truncate = require_truncate(); var Comparator = require_comparator(); var Range2 = require_range(); @@ -36159,7 +36159,7 @@ var require_semver2 = __commonJS({ gte: gte7, lte: lte2, cmp, - coerce: coerce3, + coerce: coerce4, truncate, Comparator, Range: Range2, @@ -40776,7 +40776,7 @@ var require_internal_globber = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.DefaultGlobber = void 0; var core29 = __importStar2(require_core()); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var globOptionsHelper = __importStar2(require_internal_glob_options_helper()); var path30 = __importStar2(require("path")); var patternHelper = __importStar2(require_internal_pattern_helper()); @@ -40830,7 +40830,7 @@ var require_internal_globber = __commonJS({ for (const searchPath of patternHelper.getSearchPaths(patterns)) { core29.debug(`Search path '${searchPath}'`); try { - yield __await2(fs33.promises.lstat(searchPath)); + yield __await2(fs34.promises.lstat(searchPath)); } catch (err) { if (err.code === "ENOENT") { continue; @@ -40864,7 +40864,7 @@ var require_internal_globber = __commonJS({ continue; } const childLevel = item.level + 1; - const childItems = (yield __await2(fs33.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path30.join(item.path, x), childLevel)); + const childItems = (yield __await2(fs34.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path30.join(item.path, x), childLevel)); stack.push(...childItems.reverse()); } else if (match2 & internal_match_kind_1.MatchKind.File) { yield yield __await2(item.path); @@ -40899,7 +40899,7 @@ var require_internal_globber = __commonJS({ let stats; if (options.followSymbolicLinks) { try { - stats = yield fs33.promises.stat(item.path); + stats = yield fs34.promises.stat(item.path); } catch (err) { if (err.code === "ENOENT") { if (options.omitBrokenSymbolicLinks) { @@ -40911,10 +40911,10 @@ var require_internal_globber = __commonJS({ throw err; } } else { - stats = yield fs33.promises.lstat(item.path); + stats = yield fs34.promises.lstat(item.path); } if (stats.isDirectory() && options.followSymbolicLinks) { - const realPath = yield fs33.promises.realpath(item.path); + const realPath = yield fs34.promises.realpath(item.path); while (traversalChain.length >= item.level) { traversalChain.pop(); } @@ -41023,7 +41023,7 @@ var require_internal_hash_files = __commonJS({ exports2.hashFiles = hashFiles2; var crypto3 = __importStar2(require("crypto")); var core29 = __importStar2(require_core()); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var stream2 = __importStar2(require("stream")); var util4 = __importStar2(require("util")); var path30 = __importStar2(require("path")); @@ -41046,13 +41046,13 @@ var require_internal_hash_files = __commonJS({ writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`); continue; } - if (fs33.statSync(file).isDirectory()) { + if (fs34.statSync(file).isDirectory()) { writeDelegate(`Skip directory '${file}'.`); continue; } const hash2 = crypto3.createHash("sha256"); const pipeline2 = util4.promisify(stream2.pipeline); - yield pipeline2(fs33.createReadStream(file), hash2); + yield pipeline2(fs34.createReadStream(file), hash2); result.write(hash2.digest()); count++; if (!hasMatch) { @@ -42258,8 +42258,8 @@ var require_semver3 = __commonJS({ r2 = new Range2(r2, options); return r1.intersects(r2); } - exports2.coerce = coerce3; - function coerce3(version, options) { + exports2.coerce = coerce4; + function coerce4(version, options) { if (version instanceof SemVer) { return version; } @@ -42428,7 +42428,7 @@ var require_cacheUtils = __commonJS({ var glob2 = __importStar2(require_glob()); var io9 = __importStar2(require_io()); var crypto3 = __importStar2(require("crypto")); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var path30 = __importStar2(require("path")); var semver12 = __importStar2(require_semver3()); var util4 = __importStar2(require("util")); @@ -42457,7 +42457,7 @@ var require_cacheUtils = __commonJS({ }); } function getArchiveFileSizeInBytes(filePath) { - return fs33.statSync(filePath).size; + return fs34.statSync(filePath).size; } function resolvePaths(patterns) { return __awaiter2(this, void 0, void 0, function* () { @@ -42495,7 +42495,7 @@ var require_cacheUtils = __commonJS({ } function unlinkFile(filePath) { return __awaiter2(this, void 0, void 0, function* () { - return util4.promisify(fs33.unlink)(filePath); + return util4.promisify(fs34.unlink)(filePath); }); } function getVersion(app_1) { @@ -42537,7 +42537,7 @@ var require_cacheUtils = __commonJS({ } function getGnuTarPathOnWindows() { return __awaiter2(this, void 0, void 0, function* () { - if (fs33.existsSync(constants_1.GnuTarPathOnWindows)) { + if (fs34.existsSync(constants_1.GnuTarPathOnWindows)) { return constants_1.GnuTarPathOnWindows; } const versionOutput = yield getVersion("tar"); @@ -45310,7 +45310,7 @@ var require_common = __commonJS({ function setup(env) { createDebug.debug = createDebug; createDebug.default = createDebug; - createDebug.coerce = coerce3; + createDebug.coerce = coerce4; createDebug.disable = disable; createDebug.enable = enable; createDebug.enabled = enabled; @@ -45465,7 +45465,7 @@ var require_common = __commonJS({ } return false; } - function coerce3(val) { + function coerce4(val) { if (val instanceof Error) { return val.stack || val.message; } @@ -50678,11 +50678,11 @@ var require_tracingPolicy = __commonJS({ var import_log = require_log3(); var import_core_util = require_commonjs4(); var import_restError = require_restError3(); - var import_util60 = require_internal3(); + var import_util62 = require_internal3(); var tracingPolicyName2 = "tracingPolicy"; function tracingPolicy2(options = {}) { const userAgentPromise = (0, import_userAgent.getUserAgentValue)(options.userAgentPrefix); - const sanitizer = new import_util60.Sanitizer({ + const sanitizer = new import_util62.Sanitizer({ additionalAllowedQueryParameters: options.additionalAllowedQueryParameters }); const tracingClient = tryCreateTracingClient(); @@ -54308,11 +54308,11 @@ var require_response2 = __commonJS({ }); module2.exports = __toCommonJS2(response_exports); var import_core_rest_pipeline = require_commonjs6(); - var import_util60 = require_util7(); + var import_util62 = require_util7(); var originalResponse = /* @__PURE__ */ Symbol("Original FullOperationResponse"); function toCompatResponse2(response, options) { - let request3 = (0, import_util60.toWebResourceLike)(response.request); - let headers = (0, import_util60.toHttpHeadersLike)(response.headers); + let request3 = (0, import_util62.toWebResourceLike)(response.request); + let headers = (0, import_util62.toHttpHeadersLike)(response.headers); if (options?.createProxy) { return new Proxy(response, { get(target, prop, receiver) { @@ -54353,7 +54353,7 @@ var require_response2 = __commonJS({ return { ...compatResponse, headers, - request: (0, import_util60.toPipelineRequest)(compatResponse.request) + request: (0, import_util62.toPipelineRequest)(compatResponse.request) }; } } @@ -54460,7 +54460,7 @@ var require_requestPolicyFactoryPolicy = __commonJS({ requestPolicyFactoryPolicyName: () => requestPolicyFactoryPolicyName2 }); module2.exports = __toCommonJS2(requestPolicyFactoryPolicy_exports); - var import_util60 = require_util7(); + var import_util62 = require_util7(); var import_response = require_response2(); var HttpPipelineLogLevel2 = /* @__PURE__ */ ((HttpPipelineLogLevel22) => { HttpPipelineLogLevel22[HttpPipelineLogLevel22["ERROR"] = 1] = "ERROR"; @@ -54484,14 +54484,14 @@ var require_requestPolicyFactoryPolicy = __commonJS({ async sendRequest(request3, next) { let httpPipeline = { async sendRequest(httpRequest) { - const response2 = await next((0, import_util60.toPipelineRequest)(httpRequest)); + const response2 = await next((0, import_util62.toPipelineRequest)(httpRequest)); return (0, import_response.toCompatResponse)(response2, { createProxy: true }); } }; for (const factory of orderedFactories) { httpPipeline = factory.create(httpPipeline, mockRequestPolicyOptions); } - const webResourceLike = (0, import_util60.toWebResourceLike)(request3, { createProxy: true }); + const webResourceLike = (0, import_util62.toWebResourceLike)(request3, { createProxy: true }); const response = await httpPipeline.sendRequest(webResourceLike); return (0, import_response.toPipelineResponse)(response); } @@ -54526,12 +54526,12 @@ var require_httpClientAdapter = __commonJS({ }); module2.exports = __toCommonJS2(httpClientAdapter_exports); var import_response = require_response2(); - var import_util60 = require_util7(); + var import_util62 = require_util7(); function convertHttpClient2(requestPolicyClient) { return { sendRequest: async (request3) => { const response = await requestPolicyClient.sendRequest( - (0, import_util60.toWebResourceLike)(request3, { createProxy: true }) + (0, import_util62.toWebResourceLike)(request3, { createProxy: true }) ); return (0, import_response.toPipelineResponse)(response); } @@ -54569,7 +54569,7 @@ var require_commonjs9 = __commonJS({ disableKeepAlivePolicyName: () => import_disableKeepAlivePolicy.disableKeepAlivePolicyName, requestPolicyFactoryPolicyName: () => import_requestPolicyFactoryPolicy.requestPolicyFactoryPolicyName, toCompatResponse: () => import_response.toCompatResponse, - toHttpHeadersLike: () => import_util60.toHttpHeadersLike + toHttpHeadersLike: () => import_util62.toHttpHeadersLike }); module2.exports = __toCommonJS2(src_exports); var import_extendedClient = require_extendedClient(); @@ -54577,7 +54577,7 @@ var require_commonjs9 = __commonJS({ var import_requestPolicyFactoryPolicy = require_requestPolicyFactoryPolicy(); var import_disableKeepAlivePolicy = require_disableKeepAlivePolicy(); var import_httpClientAdapter = require_httpClientAdapter(); - var import_util60 = require_util7(); + var import_util62 = require_util7(); } }); @@ -107261,7 +107261,7 @@ var require_downloadUtils = __commonJS({ var http_client_1 = require_lib(); var storage_blob_1 = require_commonjs15(); var buffer = __importStar2(require("buffer")); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var stream2 = __importStar2(require("stream")); var util4 = __importStar2(require("util")); var utils = __importStar2(require_cacheUtils()); @@ -107372,7 +107372,7 @@ var require_downloadUtils = __commonJS({ exports2.DownloadProgress = DownloadProgress; function downloadCacheHttpClient(archiveLocation, archivePath) { return __awaiter2(this, void 0, void 0, function* () { - const writeStream = fs33.createWriteStream(archivePath); + const writeStream = fs34.createWriteStream(archivePath); const httpClient = new http_client_1.HttpClient("actions/cache"); const downloadResponse = yield (0, requestUtils_1.retryHttpClientResponse)("downloadCache", () => __awaiter2(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); @@ -107397,7 +107397,7 @@ var require_downloadUtils = __commonJS({ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options) { return __awaiter2(this, void 0, void 0, function* () { var _a6; - const archiveDescriptor = yield fs33.promises.open(archivePath, "w"); + const archiveDescriptor = yield fs34.promises.open(archivePath, "w"); const httpClient = new http_client_1.HttpClient("actions/cache", void 0, { socketTimeout: options.timeoutInMs, keepAlive: true @@ -107513,7 +107513,7 @@ var require_downloadUtils = __commonJS({ } else { const maxSegmentSize = Math.min(134217728, buffer.constants.MAX_LENGTH); const downloadProgress = new DownloadProgress(contentLength); - const fd = fs33.openSync(archivePath, "w"); + const fd = fs34.openSync(archivePath, "w"); try { downloadProgress.startDisplayTimer(); const controller = new abort_controller_1.AbortController(); @@ -107531,12 +107531,12 @@ var require_downloadUtils = __commonJS({ controller.abort(); throw new Error("Aborting cache download as the download time exceeded the timeout."); } else if (Buffer.isBuffer(result)) { - fs33.writeFileSync(fd, result); + fs34.writeFileSync(fd, result); } } } finally { downloadProgress.stopDisplayTimer(); - fs33.closeSync(fd); + fs34.closeSync(fd); } } }); @@ -107875,7 +107875,7 @@ var require_cacheHttpClient = __commonJS({ var core29 = __importStar2(require_core()); var http_client_1 = require_lib(); var auth_1 = require_auth(); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var url_1 = require("url"); var utils = __importStar2(require_cacheUtils()); var uploadUtils_1 = require_uploadUtils(); @@ -108016,7 +108016,7 @@ Other caches with similar key:`); return __awaiter2(this, void 0, void 0, function* () { const fileSize = utils.getArchiveFileSizeInBytes(archivePath); const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`); - const fd = fs33.openSync(archivePath, "r"); + const fd = fs34.openSync(archivePath, "r"); const uploadOptions = (0, options_1.getUploadOptions)(options); const concurrency = utils.assertDefined("uploadConcurrency", uploadOptions.uploadConcurrency); const maxChunkSize = utils.assertDefined("uploadChunkSize", uploadOptions.uploadChunkSize); @@ -108030,7 +108030,7 @@ Other caches with similar key:`); const start = offset; const end = offset + chunkSize - 1; offset += maxChunkSize; - yield uploadChunk(httpClient, resourceUrl, () => fs33.createReadStream(archivePath, { + yield uploadChunk(httpClient, resourceUrl, () => fs34.createReadStream(archivePath, { fd, start, end, @@ -108041,7 +108041,7 @@ Other caches with similar key:`); } }))); } finally { - fs33.closeSync(fd); + fs34.closeSync(fd); } return; }); @@ -114076,7 +114076,7 @@ var require_manifest = __commonJS({ var core_1 = require_core(); var os8 = require("os"); var cp = require("child_process"); - var fs33 = require("fs"); + var fs34 = require("fs"); function _findMatch(versionSpec, stable, candidates, archFilter) { return __awaiter2(this, void 0, void 0, function* () { const platFilter = os8.platform(); @@ -114138,10 +114138,10 @@ var require_manifest = __commonJS({ const lsbReleaseFile = "/etc/lsb-release"; const osReleaseFile = "/etc/os-release"; let contents = ""; - if (fs33.existsSync(lsbReleaseFile)) { - contents = fs33.readFileSync(lsbReleaseFile).toString(); - } else if (fs33.existsSync(osReleaseFile)) { - contents = fs33.readFileSync(osReleaseFile).toString(); + if (fs34.existsSync(lsbReleaseFile)) { + contents = fs34.readFileSync(lsbReleaseFile).toString(); + } else if (fs34.existsSync(osReleaseFile)) { + contents = fs34.readFileSync(osReleaseFile).toString(); } return contents; } @@ -114350,7 +114350,7 @@ var require_tool_cache = __commonJS({ var core29 = __importStar2(require_core()); var io9 = __importStar2(require_io()); var crypto3 = __importStar2(require("crypto")); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var mm = __importStar2(require_manifest()); var os8 = __importStar2(require("os")); var path30 = __importStar2(require("path")); @@ -114396,7 +114396,7 @@ var require_tool_cache = __commonJS({ } function downloadToolAttempt(url2, dest, auth2, headers) { return __awaiter2(this, void 0, void 0, function* () { - if (fs33.existsSync(dest)) { + if (fs34.existsSync(dest)) { throw new Error(`Destination file path ${dest} already exists`); } const http = new httpm.HttpClient(userAgent2, [], { @@ -114420,7 +114420,7 @@ var require_tool_cache = __commonJS({ const readStream = responseMessageFactory(); let succeeded = false; try { - yield pipeline2(readStream, fs33.createWriteStream(dest)); + yield pipeline2(readStream, fs34.createWriteStream(dest)); core29.debug("download complete"); succeeded = true; return dest; @@ -114632,11 +114632,11 @@ var require_tool_cache = __commonJS({ arch2 = arch2 || os8.arch(); core29.debug(`Caching tool ${tool} ${version} ${arch2}`); core29.debug(`source dir: ${sourceDir}`); - if (!fs33.statSync(sourceDir).isDirectory()) { + if (!fs34.statSync(sourceDir).isDirectory()) { throw new Error("sourceDir is not a directory"); } const destPath = yield _createToolPath(tool, version, arch2); - for (const itemName of fs33.readdirSync(sourceDir)) { + for (const itemName of fs34.readdirSync(sourceDir)) { const s = path30.join(sourceDir, itemName); yield io9.cp(s, destPath, { recursive: true }); } @@ -114650,7 +114650,7 @@ var require_tool_cache = __commonJS({ arch2 = arch2 || os8.arch(); core29.debug(`Caching tool ${tool} ${version} ${arch2}`); core29.debug(`source file: ${sourceFile}`); - if (!fs33.statSync(sourceFile).isFile()) { + if (!fs34.statSync(sourceFile).isFile()) { throw new Error("sourceFile is not a file"); } const destFolder = yield _createToolPath(tool, version, arch2); @@ -114679,7 +114679,7 @@ var require_tool_cache = __commonJS({ versionSpec = semver12.clean(versionSpec) || ""; const cachePath = path30.join(_getCacheDirectory(), toolName, versionSpec, arch2); core29.debug(`checking cache: ${cachePath}`); - if (fs33.existsSync(cachePath) && fs33.existsSync(`${cachePath}.complete`)) { + if (fs34.existsSync(cachePath) && fs34.existsSync(`${cachePath}.complete`)) { core29.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch2}`); toolPath = cachePath; } else { @@ -114692,12 +114692,12 @@ var require_tool_cache = __commonJS({ const versions = []; arch2 = arch2 || os8.arch(); const toolPath = path30.join(_getCacheDirectory(), toolName); - if (fs33.existsSync(toolPath)) { - const children = fs33.readdirSync(toolPath); + if (fs34.existsSync(toolPath)) { + const children = fs34.readdirSync(toolPath); for (const child of children) { if (isExplicitVersion(child)) { const fullPath = path30.join(toolPath, child, arch2 || ""); - if (fs33.existsSync(fullPath) && fs33.existsSync(`${fullPath}.complete`)) { + if (fs34.existsSync(fullPath) && fs34.existsSync(`${fullPath}.complete`)) { versions.push(child); } } @@ -114768,7 +114768,7 @@ var require_tool_cache = __commonJS({ function _completeToolPath(tool, version, arch2) { const folderPath = path30.join(_getCacheDirectory(), tool, semver12.clean(version) || version, arch2 || ""); const markerPath = `${folderPath}.complete`; - fs33.writeFileSync(markerPath, ""); + fs34.writeFileSync(markerPath, ""); core29.debug("finished caching tool"); } function isExplicitVersion(versionSpec) { @@ -120981,15 +120981,15 @@ var require_upload_zip_specification = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getUploadZipSpecification = exports2.validateRootDirectory = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var core_1 = require_core(); var path_1 = require("path"); var path_and_artifact_name_validation_1 = require_path_and_artifact_name_validation(); function validateRootDirectory(rootDirectory) { - if (!fs33.existsSync(rootDirectory)) { + if (!fs34.existsSync(rootDirectory)) { throw new Error(`The provided rootDirectory ${rootDirectory} does not exist`); } - if (!fs33.statSync(rootDirectory).isDirectory()) { + if (!fs34.statSync(rootDirectory).isDirectory()) { throw new Error(`The provided rootDirectory ${rootDirectory} is not a valid directory`); } (0, core_1.info)(`Root directory input is valid!`); @@ -121000,7 +121000,7 @@ var require_upload_zip_specification = __commonJS({ rootDirectory = (0, path_1.normalize)(rootDirectory); rootDirectory = (0, path_1.resolve)(rootDirectory); for (let file of filesToZip) { - const stats = fs33.lstatSync(file, { throwIfNoEntry: false }); + const stats = fs34.lstatSync(file, { throwIfNoEntry: false }); if (!stats) { throw new Error(`File ${file} does not exist`); } @@ -122075,13 +122075,13 @@ var require_minimatch2 = __commonJS({ var require_readdir_glob = __commonJS({ "node_modules/@actions/artifact/node_modules/readdir-glob/index.js"(exports2, module2) { module2.exports = readdirGlob2; - var fs33 = require("fs"); + var fs34 = require("fs"); var { EventEmitter: EventEmitter2 } = require("events"); var { Minimatch: Minimatch2 } = require_minimatch2(); var { resolve: resolve15 } = require("path"); function readdir3(dir, strict) { return new Promise((resolve16, reject) => { - fs33.readdir(dir, { withFileTypes: true }, (err, files) => { + fs34.readdir(dir, { withFileTypes: true }, (err, files) => { if (err) { switch (err.code) { case "ENOTDIR": @@ -122114,7 +122114,7 @@ var require_readdir_glob = __commonJS({ } function stat2(file, followSymlinks) { return new Promise((resolve16, reject) => { - const statFunc = followSymlinks ? fs33.stat : fs33.lstat; + const statFunc = followSymlinks ? fs34.stat : fs34.lstat; statFunc(file, (err, stats) => { if (err) { switch (err.code) { @@ -124179,54 +124179,54 @@ var require_polyfills = __commonJS({ } var chdir; module2.exports = patch; - function patch(fs33) { + function patch(fs34) { if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs33); + patchLchmod(fs34); } - if (!fs33.lutimes) { - patchLutimes(fs33); + if (!fs34.lutimes) { + patchLutimes(fs34); } - fs33.chown = chownFix(fs33.chown); - fs33.fchown = chownFix(fs33.fchown); - fs33.lchown = chownFix(fs33.lchown); - fs33.chmod = chmodFix(fs33.chmod); - fs33.fchmod = chmodFix(fs33.fchmod); - fs33.lchmod = chmodFix(fs33.lchmod); - fs33.chownSync = chownFixSync(fs33.chownSync); - fs33.fchownSync = chownFixSync(fs33.fchownSync); - fs33.lchownSync = chownFixSync(fs33.lchownSync); - fs33.chmodSync = chmodFixSync(fs33.chmodSync); - fs33.fchmodSync = chmodFixSync(fs33.fchmodSync); - fs33.lchmodSync = chmodFixSync(fs33.lchmodSync); - fs33.stat = statFix(fs33.stat); - fs33.fstat = statFix(fs33.fstat); - fs33.lstat = statFix(fs33.lstat); - fs33.statSync = statFixSync(fs33.statSync); - fs33.fstatSync = statFixSync(fs33.fstatSync); - fs33.lstatSync = statFixSync(fs33.lstatSync); - if (fs33.chmod && !fs33.lchmod) { - fs33.lchmod = function(path30, mode, cb) { + fs34.chown = chownFix(fs34.chown); + fs34.fchown = chownFix(fs34.fchown); + fs34.lchown = chownFix(fs34.lchown); + fs34.chmod = chmodFix(fs34.chmod); + fs34.fchmod = chmodFix(fs34.fchmod); + fs34.lchmod = chmodFix(fs34.lchmod); + fs34.chownSync = chownFixSync(fs34.chownSync); + fs34.fchownSync = chownFixSync(fs34.fchownSync); + fs34.lchownSync = chownFixSync(fs34.lchownSync); + fs34.chmodSync = chmodFixSync(fs34.chmodSync); + fs34.fchmodSync = chmodFixSync(fs34.fchmodSync); + fs34.lchmodSync = chmodFixSync(fs34.lchmodSync); + fs34.stat = statFix(fs34.stat); + fs34.fstat = statFix(fs34.fstat); + fs34.lstat = statFix(fs34.lstat); + fs34.statSync = statFixSync(fs34.statSync); + fs34.fstatSync = statFixSync(fs34.fstatSync); + fs34.lstatSync = statFixSync(fs34.lstatSync); + if (fs34.chmod && !fs34.lchmod) { + fs34.lchmod = function(path30, mode, cb) { if (cb) process.nextTick(cb); }; - fs33.lchmodSync = function() { + fs34.lchmodSync = function() { }; } - if (fs33.chown && !fs33.lchown) { - fs33.lchown = function(path30, uid, gid, cb) { + if (fs34.chown && !fs34.lchown) { + fs34.lchown = function(path30, uid, gid, cb) { if (cb) process.nextTick(cb); }; - fs33.lchownSync = function() { + fs34.lchownSync = function() { }; } if (platform2 === "win32") { - fs33.rename = typeof fs33.rename !== "function" ? fs33.rename : (function(fs$rename) { + fs34.rename = typeof fs34.rename !== "function" ? fs34.rename : (function(fs$rename) { function rename(from, to, cb) { var start = Date.now(); var backoff = 0; fs$rename(from, to, function CB(er) { if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) { setTimeout(function() { - fs33.stat(to, function(stater, st) { + fs34.stat(to, function(stater, st) { if (stater && stater.code === "ENOENT") fs$rename(from, to, CB); else @@ -124242,9 +124242,9 @@ var require_polyfills = __commonJS({ } if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename); return rename; - })(fs33.rename); + })(fs34.rename); } - fs33.read = typeof fs33.read !== "function" ? fs33.read : (function(fs$read) { + fs34.read = typeof fs34.read !== "function" ? fs34.read : (function(fs$read) { function read(fd, buffer, offset, length, position, callback_) { var callback; if (callback_ && typeof callback_ === "function") { @@ -124252,22 +124252,22 @@ var require_polyfills = __commonJS({ callback = function(er, _2, __) { if (er && er.code === "EAGAIN" && eagCounter < 10) { eagCounter++; - return fs$read.call(fs33, fd, buffer, offset, length, position, callback); + return fs$read.call(fs34, fd, buffer, offset, length, position, callback); } callback_.apply(this, arguments); }; } - return fs$read.call(fs33, fd, buffer, offset, length, position, callback); + return fs$read.call(fs34, fd, buffer, offset, length, position, callback); } if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read); return read; - })(fs33.read); - fs33.readSync = typeof fs33.readSync !== "function" ? fs33.readSync : /* @__PURE__ */ (function(fs$readSync) { + })(fs34.read); + fs34.readSync = typeof fs34.readSync !== "function" ? fs34.readSync : /* @__PURE__ */ (function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { try { - return fs$readSync.call(fs33, fd, buffer, offset, length, position); + return fs$readSync.call(fs34, fd, buffer, offset, length, position); } catch (er) { if (er.code === "EAGAIN" && eagCounter < 10) { eagCounter++; @@ -124277,10 +124277,10 @@ var require_polyfills = __commonJS({ } } }; - })(fs33.readSync); - function patchLchmod(fs34) { - fs34.lchmod = function(path30, mode, callback) { - fs34.open( + })(fs34.readSync); + function patchLchmod(fs35) { + fs35.lchmod = function(path30, mode, callback) { + fs35.open( path30, constants.O_WRONLY | constants.O_SYMLINK, mode, @@ -124289,80 +124289,80 @@ var require_polyfills = __commonJS({ if (callback) callback(err); return; } - fs34.fchmod(fd, mode, function(err2) { - fs34.close(fd, function(err22) { + fs35.fchmod(fd, mode, function(err2) { + fs35.close(fd, function(err22) { if (callback) callback(err2 || err22); }); }); } ); }; - fs34.lchmodSync = function(path30, mode) { - var fd = fs34.openSync(path30, constants.O_WRONLY | constants.O_SYMLINK, mode); + fs35.lchmodSync = function(path30, mode) { + var fd = fs35.openSync(path30, constants.O_WRONLY | constants.O_SYMLINK, mode); var threw = true; var ret; try { - ret = fs34.fchmodSync(fd, mode); + ret = fs35.fchmodSync(fd, mode); threw = false; } finally { if (threw) { try { - fs34.closeSync(fd); + fs35.closeSync(fd); } catch (er) { } } else { - fs34.closeSync(fd); + fs35.closeSync(fd); } } return ret; }; } - function patchLutimes(fs34) { - if (constants.hasOwnProperty("O_SYMLINK") && fs34.futimes) { - fs34.lutimes = function(path30, at, mt, cb) { - fs34.open(path30, constants.O_SYMLINK, function(er, fd) { + function patchLutimes(fs35) { + if (constants.hasOwnProperty("O_SYMLINK") && fs35.futimes) { + fs35.lutimes = function(path30, at, mt, cb) { + fs35.open(path30, constants.O_SYMLINK, function(er, fd) { if (er) { if (cb) cb(er); return; } - fs34.futimes(fd, at, mt, function(er2) { - fs34.close(fd, function(er22) { + fs35.futimes(fd, at, mt, function(er2) { + fs35.close(fd, function(er22) { if (cb) cb(er2 || er22); }); }); }); }; - fs34.lutimesSync = function(path30, at, mt) { - var fd = fs34.openSync(path30, constants.O_SYMLINK); + fs35.lutimesSync = function(path30, at, mt) { + var fd = fs35.openSync(path30, constants.O_SYMLINK); var ret; var threw = true; try { - ret = fs34.futimesSync(fd, at, mt); + ret = fs35.futimesSync(fd, at, mt); threw = false; } finally { if (threw) { try { - fs34.closeSync(fd); + fs35.closeSync(fd); } catch (er) { } } else { - fs34.closeSync(fd); + fs35.closeSync(fd); } } return ret; }; - } else if (fs34.futimes) { - fs34.lutimes = function(_a6, _b2, _c2, cb) { + } else if (fs35.futimes) { + fs35.lutimes = function(_a6, _b2, _c2, cb) { if (cb) process.nextTick(cb); }; - fs34.lutimesSync = function() { + fs35.lutimesSync = function() { }; } } function chmodFix(orig) { if (!orig) return orig; return function(target, mode, cb) { - return orig.call(fs33, target, mode, function(er) { + return orig.call(fs34, target, mode, function(er) { if (chownErOk(er)) er = null; if (cb) cb.apply(this, arguments); }); @@ -124372,7 +124372,7 @@ var require_polyfills = __commonJS({ if (!orig) return orig; return function(target, mode) { try { - return orig.call(fs33, target, mode); + return orig.call(fs34, target, mode); } catch (er) { if (!chownErOk(er)) throw er; } @@ -124381,7 +124381,7 @@ var require_polyfills = __commonJS({ function chownFix(orig) { if (!orig) return orig; return function(target, uid, gid, cb) { - return orig.call(fs33, target, uid, gid, function(er) { + return orig.call(fs34, target, uid, gid, function(er) { if (chownErOk(er)) er = null; if (cb) cb.apply(this, arguments); }); @@ -124391,7 +124391,7 @@ var require_polyfills = __commonJS({ if (!orig) return orig; return function(target, uid, gid) { try { - return orig.call(fs33, target, uid, gid); + return orig.call(fs34, target, uid, gid); } catch (er) { if (!chownErOk(er)) throw er; } @@ -124411,13 +124411,13 @@ var require_polyfills = __commonJS({ } if (cb) cb.apply(this, arguments); } - return options ? orig.call(fs33, target, options, callback) : orig.call(fs33, target, callback); + return options ? orig.call(fs34, target, options, callback) : orig.call(fs34, target, callback); }; } function statFixSync(orig) { if (!orig) return orig; return function(target, options) { - var stats = options ? orig.call(fs33, target, options) : orig.call(fs33, target); + var stats = options ? orig.call(fs34, target, options) : orig.call(fs34, target); if (stats) { if (stats.uid < 0) stats.uid += 4294967296; if (stats.gid < 0) stats.gid += 4294967296; @@ -124446,7 +124446,7 @@ var require_legacy_streams = __commonJS({ "node_modules/graceful-fs/legacy-streams.js"(exports2, module2) { var Stream = require("stream").Stream; module2.exports = legacy; - function legacy(fs33) { + function legacy(fs34) { return { ReadStream, WriteStream @@ -124489,7 +124489,7 @@ var require_legacy_streams = __commonJS({ }); return; } - fs33.open(this.path, this.flags, this.mode, function(err, fd) { + fs34.open(this.path, this.flags, this.mode, function(err, fd) { if (err) { self2.emit("error", err); self2.readable = false; @@ -124528,7 +124528,7 @@ var require_legacy_streams = __commonJS({ this.busy = false; this._queue = []; if (this.fd === null) { - this._open = fs33.open; + this._open = fs34.open; this._queue.push([this._open, this.path, this.flags, this.mode, void 0]); this.flush(); } @@ -124563,7 +124563,7 @@ var require_clone = __commonJS({ // node_modules/graceful-fs/graceful-fs.js var require_graceful_fs = __commonJS({ "node_modules/graceful-fs/graceful-fs.js"(exports2, module2) { - var fs33 = require("fs"); + var fs34 = require("fs"); var polyfills = require_polyfills(); var legacy = require_legacy_streams(); var clone = require_clone(); @@ -124595,12 +124595,12 @@ var require_graceful_fs = __commonJS({ m = "GFS4: " + m.split(/\n/).join("\nGFS4: "); console.error(m); }; - if (!fs33[gracefulQueue]) { + if (!fs34[gracefulQueue]) { queue2 = global[gracefulQueue] || []; - publishQueue(fs33, queue2); - fs33.close = (function(fs$close) { + publishQueue(fs34, queue2); + fs34.close = (function(fs$close) { function close(fd, cb) { - return fs$close.call(fs33, fd, function(err) { + return fs$close.call(fs34, fd, function(err) { if (!err) { resetQueue(); } @@ -124612,40 +124612,40 @@ var require_graceful_fs = __commonJS({ value: fs$close }); return close; - })(fs33.close); - fs33.closeSync = (function(fs$closeSync) { + })(fs34.close); + fs34.closeSync = (function(fs$closeSync) { function closeSync(fd) { - fs$closeSync.apply(fs33, arguments); + fs$closeSync.apply(fs34, arguments); resetQueue(); } Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync }); return closeSync; - })(fs33.closeSync); + })(fs34.closeSync); if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) { process.on("exit", function() { - debug6(fs33[gracefulQueue]); - require("assert").equal(fs33[gracefulQueue].length, 0); + debug6(fs34[gracefulQueue]); + require("assert").equal(fs34[gracefulQueue].length, 0); }); } } var queue2; if (!global[gracefulQueue]) { - publishQueue(global, fs33[gracefulQueue]); + publishQueue(global, fs34[gracefulQueue]); } - module2.exports = patch(clone(fs33)); - if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs33.__patched) { - module2.exports = patch(fs33); - fs33.__patched = true; + module2.exports = patch(clone(fs34)); + if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs34.__patched) { + module2.exports = patch(fs34); + fs34.__patched = true; } - function patch(fs34) { - polyfills(fs34); - fs34.gracefulify = patch; - fs34.createReadStream = createReadStream4; - fs34.createWriteStream = createWriteStream3; - var fs$readFile = fs34.readFile; - fs34.readFile = readFile; + function patch(fs35) { + polyfills(fs35); + fs35.gracefulify = patch; + fs35.createReadStream = createReadStream4; + fs35.createWriteStream = createWriteStream3; + var fs$readFile = fs35.readFile; + fs35.readFile = readFile; function readFile(path30, options, cb) { if (typeof options === "function") cb = options, options = null; @@ -124661,8 +124661,8 @@ var require_graceful_fs = __commonJS({ }); } } - var fs$writeFile = fs34.writeFile; - fs34.writeFile = writeFile; + var fs$writeFile = fs35.writeFile; + fs35.writeFile = writeFile; function writeFile(path30, data, options, cb) { if (typeof options === "function") cb = options, options = null; @@ -124678,9 +124678,9 @@ var require_graceful_fs = __commonJS({ }); } } - var fs$appendFile = fs34.appendFile; + var fs$appendFile = fs35.appendFile; if (fs$appendFile) - fs34.appendFile = appendFile; + fs35.appendFile = appendFile; function appendFile(path30, data, options, cb) { if (typeof options === "function") cb = options, options = null; @@ -124696,9 +124696,9 @@ var require_graceful_fs = __commonJS({ }); } } - var fs$copyFile = fs34.copyFile; + var fs$copyFile = fs35.copyFile; if (fs$copyFile) - fs34.copyFile = copyFile2; + fs35.copyFile = copyFile2; function copyFile2(src, dest, flags, cb) { if (typeof flags === "function") { cb = flags; @@ -124716,8 +124716,8 @@ var require_graceful_fs = __commonJS({ }); } } - var fs$readdir = fs34.readdir; - fs34.readdir = readdir3; + var fs$readdir = fs35.readdir; + fs35.readdir = readdir3; var noReaddirOptionVersions = /^v[0-5]\./; function readdir3(path30, options, cb) { if (typeof options === "function") @@ -124758,21 +124758,21 @@ var require_graceful_fs = __commonJS({ } } if (process.version.substr(0, 4) === "v0.8") { - var legStreams = legacy(fs34); + var legStreams = legacy(fs35); ReadStream = legStreams.ReadStream; WriteStream = legStreams.WriteStream; } - var fs$ReadStream = fs34.ReadStream; + var fs$ReadStream = fs35.ReadStream; if (fs$ReadStream) { ReadStream.prototype = Object.create(fs$ReadStream.prototype); ReadStream.prototype.open = ReadStream$open; } - var fs$WriteStream = fs34.WriteStream; + var fs$WriteStream = fs35.WriteStream; if (fs$WriteStream) { WriteStream.prototype = Object.create(fs$WriteStream.prototype); WriteStream.prototype.open = WriteStream$open; } - Object.defineProperty(fs34, "ReadStream", { + Object.defineProperty(fs35, "ReadStream", { get: function() { return ReadStream; }, @@ -124782,7 +124782,7 @@ var require_graceful_fs = __commonJS({ enumerable: true, configurable: true }); - Object.defineProperty(fs34, "WriteStream", { + Object.defineProperty(fs35, "WriteStream", { get: function() { return WriteStream; }, @@ -124793,7 +124793,7 @@ var require_graceful_fs = __commonJS({ configurable: true }); var FileReadStream = ReadStream; - Object.defineProperty(fs34, "FileReadStream", { + Object.defineProperty(fs35, "FileReadStream", { get: function() { return FileReadStream; }, @@ -124804,7 +124804,7 @@ var require_graceful_fs = __commonJS({ configurable: true }); var FileWriteStream = WriteStream; - Object.defineProperty(fs34, "FileWriteStream", { + Object.defineProperty(fs35, "FileWriteStream", { get: function() { return FileWriteStream; }, @@ -124853,13 +124853,13 @@ var require_graceful_fs = __commonJS({ }); } function createReadStream4(path30, options) { - return new fs34.ReadStream(path30, options); + return new fs35.ReadStream(path30, options); } function createWriteStream3(path30, options) { - return new fs34.WriteStream(path30, options); + return new fs35.WriteStream(path30, options); } - var fs$open = fs34.open; - fs34.open = open; + var fs$open = fs35.open; + fs35.open = open; function open(path30, flags, mode, cb) { if (typeof mode === "function") cb = mode, mode = null; @@ -124875,20 +124875,20 @@ var require_graceful_fs = __commonJS({ }); } } - return fs34; + return fs35; } function enqueue(elem) { debug6("ENQUEUE", elem[0].name, elem[1]); - fs33[gracefulQueue].push(elem); + fs34[gracefulQueue].push(elem); retry2(); } var retryTimer; function resetQueue() { var now = Date.now(); - for (var i = 0; i < fs33[gracefulQueue].length; ++i) { - if (fs33[gracefulQueue][i].length > 2) { - fs33[gracefulQueue][i][3] = now; - fs33[gracefulQueue][i][4] = now; + for (var i = 0; i < fs34[gracefulQueue].length; ++i) { + if (fs34[gracefulQueue][i].length > 2) { + fs34[gracefulQueue][i][3] = now; + fs34[gracefulQueue][i][4] = now; } } retry2(); @@ -124896,9 +124896,9 @@ var require_graceful_fs = __commonJS({ function retry2() { clearTimeout(retryTimer); retryTimer = void 0; - if (fs33[gracefulQueue].length === 0) + if (fs34[gracefulQueue].length === 0) return; - var elem = fs33[gracefulQueue].shift(); + var elem = fs34[gracefulQueue].shift(); var fn = elem[0]; var args = elem[1]; var err = elem[2]; @@ -124920,7 +124920,7 @@ var require_graceful_fs = __commonJS({ debug6("RETRY", fn.name, args); fn.apply(null, args.concat([startTime])); } else { - fs33[gracefulQueue].push(elem); + fs34[gracefulQueue].push(elem); } } if (retryTimer === void 0) { @@ -135743,7 +135743,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur g.minimatch.escape = vi.escape; g.minimatch.unescape = Ei.unescape; }); - var fs33 = R((Wt) => { + var fs34 = R((Wt) => { "use strict"; Object.defineProperty(Wt, "__esModule", { value: true }); Wt.LRUCache = void 0; @@ -136612,7 +136612,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur }; Object.defineProperty(_2, "__esModule", { value: true }); _2.PathScurry = _2.Path = _2.PathScurryDarwin = _2.PathScurryPosix = _2.PathScurryWin32 = _2.PathScurryBase = _2.PathPosix = _2.PathWin32 = _2.PathBase = _2.ChildrenCache = _2.ResolveCache = void 0; - var Qt = fs33(), Yt = require("node:path"), yr = require("node:url"), pt = require("fs"), Sr = br(require("node:fs")), vr = pt.realpathSync.native, Ht = require("node:fs/promises"), bs = Oe(), mt = { lstatSync: pt.lstatSync, readdir: pt.readdir, readdirSync: pt.readdirSync, readlinkSync: pt.readlinkSync, realpathSync: vr, promises: { lstat: Ht.lstat, readdir: Ht.readdir, readlink: Ht.readlink, realpath: Ht.realpath } }, _s2 = (n) => !n || n === mt || n === Sr ? mt : { ...mt, ...n, promises: { ...mt.promises, ...n.promises || {} } }, Os = /^\\\\\?\\([a-z]:)\\?$/i, Er = (n) => n.replace(/\//g, "\\").replace(Os, "$1\\"), _r2 = /[\\\/]/, N = 0, xs = 1, Ts = 2, G = 4, Cs = 6, Rs = 8, Q = 10, As = 12, j = 15, dt = ~j, xe = 16, ys = 32, gt = 64, W = 128, Vt = 256, Xt = 512, Ss = gt | W | Xt, Or = 1023, Te = (n) => n.isFile() ? Rs : n.isDirectory() ? G : n.isSymbolicLink() ? Q : n.isCharacterDevice() ? Ts : n.isBlockDevice() ? Cs : n.isSocket() ? As : n.isFIFO() ? xs : N, vs = new Qt.LRUCache({ max: 2 ** 12 }), wt = (n) => { + var Qt = fs34(), Yt = require("node:path"), yr = require("node:url"), pt = require("fs"), Sr = br(require("node:fs")), vr = pt.realpathSync.native, Ht = require("node:fs/promises"), bs = Oe(), mt = { lstatSync: pt.lstatSync, readdir: pt.readdir, readdirSync: pt.readdirSync, readlinkSync: pt.readlinkSync, realpathSync: vr, promises: { lstat: Ht.lstat, readdir: Ht.readdir, readlink: Ht.readlink, realpath: Ht.realpath } }, _s2 = (n) => !n || n === mt || n === Sr ? mt : { ...mt, ...n, promises: { ...mt.promises, ...n.promises || {} } }, Os = /^\\\\\?\\([a-z]:)\\?$/i, Er = (n) => n.replace(/\//g, "\\").replace(Os, "$1\\"), _r2 = /[\\\/]/, N = 0, xs = 1, Ts = 2, G = 4, Cs = 6, Rs = 8, Q = 10, As = 12, j = 15, dt = ~j, xe = 16, ys = 32, gt = 64, W = 128, Vt = 256, Xt = 512, Ss = gt | W | Xt, Or = 1023, Te = (n) => n.isFile() ? Rs : n.isDirectory() ? G : n.isSymbolicLink() ? Q : n.isCharacterDevice() ? Ts : n.isBlockDevice() ? Cs : n.isSocket() ? As : n.isFIFO() ? xs : N, vs = new Qt.LRUCache({ max: 2 ** 12 }), wt = (n) => { let t = vs.get(n); if (t) return t; let e = n.normalize("NFKD"); @@ -137990,7 +137990,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur // node_modules/archiver-utils/file.js var require_file2 = __commonJS({ "node_modules/archiver-utils/file.js"(exports2, module2) { - var fs33 = require_graceful_fs(); + var fs34 = require_graceful_fs(); var path30 = require("path"); var flatten = require_flatten(); var difference = require_difference(); @@ -138017,7 +138017,7 @@ var require_file2 = __commonJS({ }; file.exists = function() { var filepath = path30.join.apply(path30, arguments); - return fs33.existsSync(filepath); + return fs34.existsSync(filepath); }; file.expand = function(...args) { var options = isPlainObject4(args[0]) ? args.shift() : {}; @@ -138035,7 +138035,7 @@ var require_file2 = __commonJS({ if (typeof options.filter === "function") { return options.filter(filepath); } else { - return fs33.statSync(filepath)[options.filter](); + return fs34.statSync(filepath)[options.filter](); } } catch (e) { return false; @@ -138143,7 +138143,7 @@ var require_file2 = __commonJS({ // node_modules/archiver-utils/index.js var require_archiver_utils = __commonJS({ "node_modules/archiver-utils/index.js"(exports2, module2) { - var fs33 = require_graceful_fs(); + var fs34 = require_graceful_fs(); var path30 = require("path"); var isStream2 = require_is_stream(); var lazystream = require_lazystream(); @@ -138192,7 +138192,7 @@ var require_archiver_utils = __commonJS({ }; utils.lazyReadStream = function(filepath) { return new lazystream.Readable(function() { - return fs33.createReadStream(filepath); + return fs34.createReadStream(filepath); }); }; utils.normalizeInputSource = function(source) { @@ -138220,7 +138220,7 @@ var require_archiver_utils = __commonJS({ callback = base; base = dirpath; } - fs33.readdir(dirpath, function(err, list) { + fs34.readdir(dirpath, function(err, list) { var i = 0; var file; var filepath; @@ -138233,7 +138233,7 @@ var require_archiver_utils = __commonJS({ return callback(null, results); } filepath = path30.join(dirpath, file); - fs33.stat(filepath, function(err2, stats) { + fs34.stat(filepath, function(err2, stats) { results.push({ path: filepath, relative: path30.relative(base, filepath).replace(/\\/g, "/"), @@ -138295,7 +138295,7 @@ var require_error3 = __commonJS({ // node_modules/@actions/artifact/node_modules/archiver/lib/core.js var require_core2 = __commonJS({ "node_modules/@actions/artifact/node_modules/archiver/lib/core.js"(exports2, module2) { - var fs33 = require("fs"); + var fs34 = require("fs"); var glob2 = require_readdir_glob(); var async = require_async(); var path30 = require("path"); @@ -138359,7 +138359,7 @@ var require_core2 = __commonJS({ data.sourcePath = filepath; task.data = data; this._entriesCount++; - if (data.stats && data.stats instanceof fs33.Stats) { + if (data.stats && data.stats instanceof fs34.Stats) { task = this._updateQueueTaskWithStats(task, data.stats); if (task) { if (data.stats.size) { @@ -138530,7 +138530,7 @@ var require_core2 = __commonJS({ callback(); return; } - fs33.lstat(task.filepath, function(err, stats) { + fs34.lstat(task.filepath, function(err, stats) { if (this._state.aborted) { setImmediate(callback); return; @@ -138573,7 +138573,7 @@ var require_core2 = __commonJS({ task.data.sourceType = "buffer"; task.source = Buffer.concat([]); } else if (stats.isSymbolicLink() && this._moduleSupports("symlink")) { - var linkPath = fs33.readlinkSync(task.filepath); + var linkPath = fs34.readlinkSync(task.filepath); var dirName = path30.dirname(task.filepath); task.data.type = "symlink"; task.data.linkname = path30.relative(dirName, path30.resolve(dirName, linkPath)); @@ -149475,7 +149475,7 @@ var require_parser_stream = __commonJS({ var require_mkdirp = __commonJS({ "node_modules/mkdirp/index.js"(exports2, module2) { var path30 = require("path"); - var fs33 = require("fs"); + var fs34 = require("fs"); var _0777 = parseInt("0777", 8); module2.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; function mkdirP(p, opts, f, made) { @@ -149486,7 +149486,7 @@ var require_mkdirp = __commonJS({ opts = { mode: opts }; } var mode = opts.mode; - var xfs = opts.fs || fs33; + var xfs = opts.fs || fs34; if (mode === void 0) { mode = _0777; } @@ -149525,7 +149525,7 @@ var require_mkdirp = __commonJS({ opts = { mode: opts }; } var mode = opts.mode; - var xfs = opts.fs || fs33; + var xfs = opts.fs || fs34; if (mode === void 0) { mode = _0777; } @@ -149562,7 +149562,7 @@ var require_mkdirp = __commonJS({ // node_modules/unzip-stream/lib/extract.js var require_extract2 = __commonJS({ "node_modules/unzip-stream/lib/extract.js"(exports2, module2) { - var fs33 = require("fs"); + var fs34 = require("fs"); var path30 = require("path"); var util4 = require("util"); var mkdirp = require_mkdirp(); @@ -149609,7 +149609,7 @@ var require_extract2 = __commonJS({ var directory = entry.isDirectory ? destPath : path30.dirname(destPath); this.unfinishedEntries++; var writeFileFn = function() { - var pipedStream = fs33.createWriteStream(destPath); + var pipedStream = fs34.createWriteStream(destPath); pipedStream.on("close", function() { self2.unfinishedEntries--; self2._notifyAwaiter(); @@ -150807,7 +150807,7 @@ var require_file_command2 = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.prepareKeyValueMessage = exports2.issueFileCommand = void 0; var crypto3 = __importStar2(require("crypto")); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var os8 = __importStar2(require("os")); var utils_1 = require_utils11(); function issueFileCommand(command, message) { @@ -150815,10 +150815,10 @@ var require_file_command2 = __commonJS({ if (!filePath) { throw new Error(`Unable to find environment variable for file command ${command}`); } - if (!fs33.existsSync(filePath)) { + if (!fs34.existsSync(filePath)) { throw new Error(`Missing file at path: ${filePath}`); } - fs33.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os8.EOL}`, { + fs34.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os8.EOL}`, { encoding: "utf8" }); } @@ -152141,12 +152141,12 @@ var require_io_util2 = __commonJS({ var _a6; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getCmdPath = exports2.tryGetExecutablePath = exports2.isRooted = exports2.isDirectory = exports2.exists = exports2.READONLY = exports2.UV_FS_O_EXLOCK = exports2.IS_WINDOWS = exports2.unlink = exports2.symlink = exports2.stat = exports2.rmdir = exports2.rm = exports2.rename = exports2.readlink = exports2.readdir = exports2.open = exports2.mkdir = exports2.lstat = exports2.copyFile = exports2.chmod = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var path30 = __importStar2(require("path")); - _a6 = fs33.promises, exports2.chmod = _a6.chmod, exports2.copyFile = _a6.copyFile, exports2.lstat = _a6.lstat, exports2.mkdir = _a6.mkdir, exports2.open = _a6.open, exports2.readdir = _a6.readdir, exports2.readlink = _a6.readlink, exports2.rename = _a6.rename, exports2.rm = _a6.rm, exports2.rmdir = _a6.rmdir, exports2.stat = _a6.stat, exports2.symlink = _a6.symlink, exports2.unlink = _a6.unlink; + _a6 = fs34.promises, exports2.chmod = _a6.chmod, exports2.copyFile = _a6.copyFile, exports2.lstat = _a6.lstat, exports2.mkdir = _a6.mkdir, exports2.open = _a6.open, exports2.readdir = _a6.readdir, exports2.readlink = _a6.readlink, exports2.rename = _a6.rename, exports2.rm = _a6.rm, exports2.rmdir = _a6.rmdir, exports2.stat = _a6.stat, exports2.symlink = _a6.symlink, exports2.unlink = _a6.unlink; exports2.IS_WINDOWS = process.platform === "win32"; exports2.UV_FS_O_EXLOCK = 268435456; - exports2.READONLY = fs33.constants.O_RDONLY; + exports2.READONLY = fs34.constants.O_RDONLY; function exists(fsPath) { return __awaiter2(this, void 0, void 0, function* () { try { @@ -153535,25 +153535,25 @@ var require_upload_specification = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getUploadSpecification = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var core_1 = require_core3(); var path_1 = require("path"); var path_and_artifact_name_validation_1 = require_path_and_artifact_name_validation2(); function getUploadSpecification(artifactName, rootDirectory, artifactFiles) { const specifications = []; - if (!fs33.existsSync(rootDirectory)) { + if (!fs34.existsSync(rootDirectory)) { throw new Error(`Provided rootDirectory ${rootDirectory} does not exist`); } - if (!fs33.statSync(rootDirectory).isDirectory()) { + if (!fs34.statSync(rootDirectory).isDirectory()) { throw new Error(`Provided rootDirectory ${rootDirectory} is not a valid directory`); } rootDirectory = (0, path_1.normalize)(rootDirectory); rootDirectory = (0, path_1.resolve)(rootDirectory); for (let file of artifactFiles) { - if (!fs33.existsSync(file)) { + if (!fs34.existsSync(file)) { throw new Error(`File ${file} does not exist`); } - if (!fs33.statSync(file).isDirectory()) { + if (!fs34.statSync(file).isDirectory()) { file = (0, path_1.normalize)(file); file = (0, path_1.resolve)(file); if (!file.startsWith(rootDirectory)) { @@ -153578,11 +153578,11 @@ var require_upload_specification = __commonJS({ // node_modules/tmp/lib/tmp.js var require_tmp = __commonJS({ "node_modules/tmp/lib/tmp.js"(exports2, module2) { - var fs33 = require("fs"); + var fs34 = require("fs"); var os8 = require("os"); var path30 = require("path"); var crypto3 = require("crypto"); - var _c2 = { fs: fs33.constants, os: os8.constants }; + var _c2 = { fs: fs34.constants, os: os8.constants }; var RANDOM_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; var TEMPLATE_PATTERN = /XXXXXX/; var DEFAULT_TRIES = 3; @@ -153594,13 +153594,13 @@ var require_tmp = __commonJS({ var FILE_MODE = 384; var EXIT = "exit"; var _removeObjects = []; - var FN_RMDIR_SYNC = fs33.rmdirSync.bind(fs33); + var FN_RMDIR_SYNC = fs34.rmdirSync.bind(fs34); var _gracefulCleanup = false; function rimraf(dirPath, callback) { - return fs33.rm(dirPath, { recursive: true }, callback); + return fs34.rm(dirPath, { recursive: true }, callback); } function FN_RIMRAF_SYNC(dirPath) { - return fs33.rmSync(dirPath, { recursive: true }); + return fs34.rmSync(dirPath, { recursive: true }); } function tmpName(options, callback) { const args = _parseArguments(options, callback), opts = args[0], cb = args[1]; @@ -153610,7 +153610,7 @@ var require_tmp = __commonJS({ (function _getUniqueName() { try { const name = _generateTmpName(sanitizedOptions); - fs33.stat(name, function(err2) { + fs34.stat(name, function(err2) { if (!err2) { if (tries-- > 0) return _getUniqueName(); return cb(new Error("Could not get a unique tmp filename, max tries reached " + name)); @@ -153630,7 +153630,7 @@ var require_tmp = __commonJS({ do { const name = _generateTmpName(sanitizedOptions); try { - fs33.statSync(name); + fs34.statSync(name); } catch (e) { return name; } @@ -153641,10 +153641,10 @@ var require_tmp = __commonJS({ const args = _parseArguments(options, callback), opts = args[0], cb = args[1]; tmpName(opts, function _tmpNameCreated(err, name) { if (err) return cb(err); - fs33.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err2, fd) { + fs34.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err2, fd) { if (err2) return cb(err2); if (opts.discardDescriptor) { - return fs33.close(fd, function _discardCallback(possibleErr) { + return fs34.close(fd, function _discardCallback(possibleErr) { return cb(possibleErr, name, void 0, _prepareTmpFileRemoveCallback(name, -1, opts, false)); }); } else { @@ -153658,9 +153658,9 @@ var require_tmp = __commonJS({ const args = _parseArguments(options), opts = args[0]; const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor; const name = tmpNameSync(opts); - let fd = fs33.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE); + let fd = fs34.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE); if (opts.discardDescriptor) { - fs33.closeSync(fd); + fs34.closeSync(fd); fd = void 0; } return { @@ -153673,7 +153673,7 @@ var require_tmp = __commonJS({ const args = _parseArguments(options, callback), opts = args[0], cb = args[1]; tmpName(opts, function _tmpNameCreated(err, name) { if (err) return cb(err); - fs33.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) { + fs34.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) { if (err2) return cb(err2); cb(null, name, _prepareTmpDirRemoveCallback(name, opts, false)); }); @@ -153682,7 +153682,7 @@ var require_tmp = __commonJS({ function dirSync(options) { const args = _parseArguments(options), opts = args[0]; const name = tmpNameSync(opts); - fs33.mkdirSync(name, opts.mode || DIR_MODE); + fs34.mkdirSync(name, opts.mode || DIR_MODE); return { name, removeCallback: _prepareTmpDirRemoveCallback(name, opts, true) @@ -153696,20 +153696,20 @@ var require_tmp = __commonJS({ next(); }; if (0 <= fdPath[0]) - fs33.close(fdPath[0], function() { - fs33.unlink(fdPath[1], _handler); + fs34.close(fdPath[0], function() { + fs34.unlink(fdPath[1], _handler); }); - else fs33.unlink(fdPath[1], _handler); + else fs34.unlink(fdPath[1], _handler); } function _removeFileSync(fdPath) { let rethrownException = null; try { - if (0 <= fdPath[0]) fs33.closeSync(fdPath[0]); + if (0 <= fdPath[0]) fs34.closeSync(fdPath[0]); } catch (e) { if (!_isEBADF(e) && !_isENOENT(e)) throw e; } finally { try { - fs33.unlinkSync(fdPath[1]); + fs34.unlinkSync(fdPath[1]); } catch (e) { if (!_isENOENT(e)) rethrownException = e; } @@ -153725,7 +153725,7 @@ var require_tmp = __commonJS({ return sync ? removeCallbackSync : removeCallback; } function _prepareTmpDirRemoveCallback(name, opts, sync) { - const removeFunction = opts.unsafeCleanup ? rimraf : fs33.rmdir.bind(fs33); + const removeFunction = opts.unsafeCleanup ? rimraf : fs34.rmdir.bind(fs34); const removeFunctionSync = opts.unsafeCleanup ? FN_RIMRAF_SYNC : FN_RMDIR_SYNC; const removeCallbackSync = _prepareRemoveCallback(removeFunctionSync, name, sync); const removeCallback = _prepareRemoveCallback(removeFunction, name, sync, removeCallbackSync); @@ -153788,24 +153788,24 @@ var require_tmp = __commonJS({ } function _resolvePath(name, tmpDir, cb) { const pathToResolve = path30.isAbsolute(name) ? name : path30.join(tmpDir, name); - fs33.stat(pathToResolve, function(err) { + fs34.stat(pathToResolve, function(err) { if (err) { - fs33.realpath(path30.dirname(pathToResolve), function(err2, parentDir) { + fs34.realpath(path30.dirname(pathToResolve), function(err2, parentDir) { if (err2) return cb(err2); cb(null, path30.join(parentDir, path30.basename(pathToResolve))); }); } else { - fs33.realpath(pathToResolve, cb); + fs34.realpath(pathToResolve, cb); } }); } function _resolvePathSync(name, tmpDir) { const pathToResolve = path30.isAbsolute(name) ? name : path30.join(tmpDir, name); try { - fs33.statSync(pathToResolve); - return fs33.realpathSync(pathToResolve); + fs34.statSync(pathToResolve); + return fs34.realpathSync(pathToResolve); } catch (_err) { - const parentDir = fs33.realpathSync(path30.dirname(pathToResolve)); + const parentDir = fs34.realpathSync(path30.dirname(pathToResolve)); return path30.join(parentDir, path30.basename(pathToResolve)); } } @@ -153926,10 +153926,10 @@ var require_tmp = __commonJS({ _gracefulCleanup = true; } function _getTmpDir(options, cb) { - return fs33.realpath(options && options.tmpdir || os8.tmpdir(), cb); + return fs34.realpath(options && options.tmpdir || os8.tmpdir(), cb); } function _getTmpDirSync(options) { - return fs33.realpathSync(options && options.tmpdir || os8.tmpdir()); + return fs34.realpathSync(options && options.tmpdir || os8.tmpdir()); } process.addListener(EXIT, _garbageCollector); Object.defineProperty(module2.exports, "tmpdir", { @@ -154783,10 +154783,10 @@ var require_upload_gzip = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.createGZipFileInBuffer = exports2.createGZipFileOnDisk = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var zlib3 = __importStar2(require("zlib")); var util_1 = require("util"); - var stat2 = (0, util_1.promisify)(fs33.stat); + var stat2 = (0, util_1.promisify)(fs34.stat); var gzipExemptFileExtensions = [ ".gz", ".gzip", @@ -154819,9 +154819,9 @@ var require_upload_gzip = __commonJS({ } } return new Promise((resolve15, reject) => { - const inputStream = fs33.createReadStream(originalFilePath); + const inputStream = fs34.createReadStream(originalFilePath); const gzip = zlib3.createGzip(); - const outputStream = fs33.createWriteStream(tempFilePath); + const outputStream = fs34.createWriteStream(tempFilePath); inputStream.pipe(gzip).pipe(outputStream); outputStream.on("finish", () => __awaiter2(this, void 0, void 0, function* () { const size = (yield stat2(tempFilePath)).size; @@ -154839,7 +154839,7 @@ var require_upload_gzip = __commonJS({ return __awaiter2(this, void 0, void 0, function* () { return new Promise((resolve15) => __awaiter2(this, void 0, void 0, function* () { var _a6, e_1, _b2, _c2; - const inputStream = fs33.createReadStream(originalFilePath); + const inputStream = fs34.createReadStream(originalFilePath); const gzip = zlib3.createGzip(); inputStream.pipe(gzip); const chunks = []; @@ -155048,7 +155048,7 @@ var require_upload_http_client = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.UploadHttpClient = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var core29 = __importStar2(require_core3()); var tmp2 = __importStar2(require_tmp_promise()); var stream2 = __importStar2(require("stream")); @@ -155062,7 +155062,7 @@ var require_upload_http_client = __commonJS({ var http_manager_1 = require_http_manager(); var upload_gzip_1 = require_upload_gzip(); var requestUtils_1 = require_requestUtils2(); - var stat2 = (0, util_1.promisify)(fs33.stat); + var stat2 = (0, util_1.promisify)(fs34.stat); var UploadHttpClient = class { constructor() { this.uploadHttpManager = new http_manager_1.HttpManager((0, config_variables_1.getUploadFileConcurrency)(), "@actions/artifact-upload"); @@ -155199,7 +155199,7 @@ var require_upload_http_client = __commonJS({ let openUploadStream; if (totalFileSize < buffer.byteLength) { core29.debug(`The gzip file created for ${parameters.file} did not help with reducing the size of the file. The original file will be uploaded as-is`); - openUploadStream = () => fs33.createReadStream(parameters.file); + openUploadStream = () => fs34.createReadStream(parameters.file); isGzip = false; uploadFileSize = totalFileSize; } else { @@ -155245,7 +155245,7 @@ var require_upload_http_client = __commonJS({ failedChunkSizes += chunkSize; continue; } - const result = yield this.uploadChunk(httpClientIndex, parameters.resourceUrl, () => fs33.createReadStream(uploadFilePath, { + const result = yield this.uploadChunk(httpClientIndex, parameters.resourceUrl, () => fs34.createReadStream(uploadFilePath, { start: startChunkIndex, end: endChunkIndex, autoClose: false @@ -155440,7 +155440,7 @@ var require_download_http_client = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.DownloadHttpClient = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var core29 = __importStar2(require_core3()); var zlib3 = __importStar2(require("zlib")); var utils_1 = require_utils12(); @@ -155531,7 +155531,7 @@ var require_download_http_client = __commonJS({ return __awaiter2(this, void 0, void 0, function* () { let retryCount = 0; const retryLimit = (0, config_variables_1.getRetryLimit)(); - let destinationStream = fs33.createWriteStream(downloadPath); + let destinationStream = fs34.createWriteStream(downloadPath); const headers = (0, utils_1.getDownloadHeaders)("application/json", true, true); const makeDownloadRequest = () => __awaiter2(this, void 0, void 0, function* () { const client = this.downloadHttpManager.getClient(httpClientIndex); @@ -155573,7 +155573,7 @@ var require_download_http_client = __commonJS({ } }); yield (0, utils_1.rmFile)(fileDownloadPath); - destinationStream = fs33.createWriteStream(fileDownloadPath); + destinationStream = fs34.createWriteStream(fileDownloadPath); }); while (retryCount <= retryLimit) { let response; @@ -173779,7 +173779,7 @@ __export(entry_points_exports, { module.exports = __toCommonJS(entry_points_exports); // src/analyze-action.ts -var fs24 = __toESM(require("fs")); +var fs25 = __toESM(require("fs")); var import_path5 = __toESM(require("path")); var import_perf_hooks6 = require("perf_hooks"); var core14 = __toESM(require_core()); @@ -173942,21 +173942,21 @@ async function getFolderSize(itemPath, options) { getFolderSize.loose = async (itemPath, options) => await core2(itemPath, options); getFolderSize.strict = async (itemPath, options) => await core2(itemPath, options, { strict: true }); async function core2(rootItemPath, options = {}, returnType = {}) { - const fs33 = options.fs || await import("node:fs/promises"); + const fs34 = options.fs || await import("node:fs/promises"); let folderSize = 0n; const foundInos = /* @__PURE__ */ new Set(); const errors = []; await processItem(rootItemPath); async function processItem(itemPath) { if (options.ignore?.test(itemPath)) return; - const stats = returnType.strict ? await fs33.lstat(itemPath, { bigint: true }) : await fs33.lstat(itemPath, { bigint: true }).catch((error3) => errors.push(error3)); + const stats = returnType.strict ? await fs34.lstat(itemPath, { bigint: true }) : await fs34.lstat(itemPath, { bigint: true }).catch((error3) => errors.push(error3)); if (typeof stats !== "object") return; if (!foundInos.has(stats.ino)) { foundInos.add(stats.ino); folderSize += stats.size; } if (stats.isDirectory()) { - const directoryItems = returnType.strict ? await fs33.readdir(itemPath) : await fs33.readdir(itemPath).catch((error3) => errors.push(error3)); + const directoryItems = returnType.strict ? await fs34.readdir(itemPath) : await fs34.readdir(itemPath).catch((error3) => errors.push(error3)); if (typeof directoryItems !== "object") return; await Promise.all( directoryItems.map( @@ -180438,13 +180438,13 @@ var SarifScanOrder = [ ]; // src/analyze.ts -var fs18 = __toESM(require("fs")); +var fs19 = __toESM(require("fs")); var path16 = __toESM(require("path")); var import_perf_hooks5 = require("perf_hooks"); var io5 = __toESM(require_io()); // src/codeql.ts -var fs17 = __toESM(require("fs")); +var fs18 = __toESM(require("fs")); var path15 = __toESM(require("path")); var core12 = __toESM(require_core()); var toolrunner3 = __toESM(require_toolrunner()); @@ -183079,7 +183079,7 @@ async function logGeneratedFilesTelemetry(config, duration, generatedFilesCount) } // src/setup-codeql.ts -var fs15 = __toESM(require("fs")); +var fs16 = __toESM(require("fs")); var path13 = __toESM(require("path")); var import_perf_hooks4 = require("perf_hooks"); var toolcache3 = __toESM(require_tool_cache()); @@ -183415,6 +183415,7 @@ async function getCodeQlVersionsForOverlayBaseDatabases(rawLanguages, logger2) { var semver7 = __toESM(require_semver2()); // src/platform.ts +var import_fs = __toESM(require("fs")); var semver6 = __toESM(require_semver2()); function getBundlePlatform(platform2 = process.platform, arch2 = process.arch) { switch (platform2) { @@ -183438,6 +183439,47 @@ function macOSVersion(action) { } return version; } +var XCODE_SELECT_LINK_PATH = "/private/var/db/xcode_select_link"; +var XCODE_APP_FILENAME_PATTERN = new RegExp( + /(?Xcode_(?\d+.\d+).app)/ +); +function xcodeVersion(logger2) { + try { + const stats = import_fs.default.statSync(XCODE_SELECT_LINK_PATH); + if (!stats.isSymbolicLink()) { + logger2.warning( + `${XCODE_SELECT_LINK_PATH} exists, but is not a symbolic link.` + ); + return void 0; + } + const xcodePath = import_fs.default.readlinkSync(XCODE_SELECT_LINK_PATH); + if (xcodePath === "") { + logger2.warning( + `Resolving ${XCODE_SELECT_LINK_PATH} unexpectedly returned nothing.` + ); + return void 0; + } + const matchResult = xcodePath.match(XCODE_APP_FILENAME_PATTERN); + if (matchResult?.groups === void 0) { + logger2.warning( + `Xcode path '${xcodePath}' does not contain expected pattern.` + ); + return void 0; + } + const majorMinor = matchResult.groups["majorMinor"]; + const version = semver6.coerce(majorMinor); + if (version === null) { + logger2.warning(`Couldn't parse '${majorMinor}' as a semantic version.`); + return void 0; + } + return version; + } catch (err) { + logger2.warning( + `Unable to determine Xcode version: ${getErrorMessage(err)}` + ); + return void 0; + } +} // src/per-language-bundles.ts var MIN_PER_LANGUAGE_BUNDLE_CLI_VERSION = "2.27.1"; @@ -183618,7 +183660,7 @@ async function getCodeQLAssetDownloadURL(action, apiDetails, tagName, assetName, // src/tar.ts var import_child_process = require("child_process"); -var fs13 = __toESM(require("fs")); +var fs14 = __toESM(require("fs")); var stream = __toESM(require("stream")); var import_toolrunner = __toESM(require_toolrunner()); var io4 = __toESM(require_io()); @@ -183691,7 +183733,7 @@ async function isZstdAvailable(logger2) { } } async function extract(tarPath, dest, compressionMethod, tarVersion, logger2) { - fs13.mkdirSync(dest, { recursive: true }); + fs14.mkdirSync(dest, { recursive: true }); switch (compressionMethod) { case "gzip": return await toolcache.extractTar(tarPath, dest); @@ -183777,7 +183819,7 @@ function inferCompressionMethod(tarPath) { } // src/tools-download.ts -var fs14 = __toESM(require("fs")); +var fs15 = __toESM(require("fs")); var os5 = __toESM(require("os")); var path12 = __toESM(require("path")); var import_perf_hooks3 = require("perf_hooks"); @@ -183863,7 +183905,7 @@ async function downloadAndExtract(codeqlURL, compressionMethod, dest, authorizat }; } async function downloadAndExtractZstdWithStreaming(codeqlURL, dest, authorization, headers, tarVersion, logger2) { - fs14.mkdirSync(dest, { recursive: true }); + fs15.mkdirSync(dest, { recursive: true }); const agent = new import_http_client.HttpClient().getAgent(codeqlURL); headers = Object.assign( { "User-Agent": "CodeQL Action" }, @@ -183922,7 +183964,7 @@ function getToolcacheDirectory(version) { } function isToolcacheOnWorkspaceFilesystem(logger2) { try { - return fs14.statSync(getRequiredEnvParam("RUNNER_TOOL_CACHE")).dev === fs14.statSync(getRequiredEnvParam("GITHUB_WORKSPACE")).dev; + return fs15.statSync(getRequiredEnvParam("RUNNER_TOOL_CACHE")).dev === fs15.statSync(getRequiredEnvParam("GITHUB_WORKSPACE")).dev; } catch (e) { logger2.debug( `Could not determine whether the toolcache is on the same filesystem as the workspace: ${getErrorMessage(e)}` @@ -183944,7 +183986,7 @@ async function deleteToolcacheBundles({ return { deletedVersions: [], failed: true }; } try { - if ((await fs14.promises.lstat(toolDirectory)).isSymbolicLink()) { + if ((await fs15.promises.lstat(toolDirectory)).isSymbolicLink()) { logger2.info( `Not deleting the CodeQL tools from the toolcache since '${toolDirectory}' is a symlink.` ); @@ -183963,7 +184005,7 @@ async function deleteToolcacheBundles({ return { deletedVersions: [], failed: true }; } try { - const entries = await fs14.promises.readdir(toolDirectory, { + const entries = await fs15.promises.readdir(toolDirectory, { withFileTypes: true }); const deletedVersions = []; @@ -183977,7 +184019,7 @@ async function deleteToolcacheBundles({ } const versionDirectory = path12.join(toolDirectory, entry.name); try { - await fs14.promises.rm(versionDirectory, { + await fs15.promises.rm(versionDirectory, { force: true, recursive: true }); @@ -184002,7 +184044,7 @@ async function deleteToolcacheBundles({ } function writeToolcacheMarkerFile(extractedPath, logger2) { const markerFilePath = `${extractedPath}.complete`; - fs14.writeFileSync(markerFilePath, ""); + fs15.writeFileSync(markerFilePath, ""); logger2.info(`Created toolcache marker file ${markerFilePath}`); } @@ -184054,7 +184096,7 @@ async function findOverridingToolsInCache(humanReadableVersion, logger2) { const candidates = toolcache3.findAllVersions("CodeQL").filter(isGoodVersion).map((version) => ({ folder: toolcache3.find("CodeQL", version), version - })).filter(({ folder }) => fs15.existsSync(path13.join(folder, "pinned-version"))); + })).filter(({ folder }) => fs16.existsSync(path13.join(folder, "pinned-version"))); if (candidates.length === 1) { const candidate = candidates[0]; logger2.debug( @@ -184676,7 +184718,7 @@ function isReservedToolsValue(tools) { } // src/tracer-config.ts -var fs16 = __toESM(require("fs")); +var fs17 = __toESM(require("fs")); var path14 = __toESM(require("path")); async function shouldEnableIndirectTracing(codeql, config) { if (config.buildMode === "none" /* None */) { @@ -184696,14 +184738,14 @@ async function endTracingForCluster(codeql, config, logger2) { config.dbLocation, "temp/tracingEnvironment/end-tracing.json" ); - if (!fs16.existsSync(envVariablesFile)) { + if (!fs17.existsSync(envVariablesFile)) { throw new Error( `Environment file for ending tracing not found: ${envVariablesFile}` ); } try { const endTracingEnvVariables = JSON.parse( - fs16.readFileSync(envVariablesFile, "utf8") + fs17.readFileSync(envVariablesFile, "utf8") ); for (const [key, value] of Object.entries(endTracingEnvVariables)) { if (value !== null) { @@ -184724,7 +184766,7 @@ async function getTracerConfigForCluster(logger2, config) { "temp/tracingEnvironment/start-tracing.json" ); try { - const tracingEnvVariables = JSON.parse(fs16.readFileSync(filePath, "utf8")); + const tracingEnvVariables = JSON.parse(fs17.readFileSync(filePath, "utf8")); return { env: tracingEnvVariables }; @@ -184847,7 +184889,7 @@ async function getCodeQLForCmd(logger2, cmd, checkVersion, env = getEnv()) { "tools", "tracing-config.lua" ); - return fs17.existsSync(tracingConfigPath); + return fs18.existsSync(tracingConfigPath); }, async isScannedLanguage(language) { return !await this.isTracedLanguage(language); @@ -185143,7 +185185,7 @@ async function getCodeQLForCmd(logger2, cmd, checkVersion, env = getEnv()) { }, async diagnosticsExport(sarifFile, automationDetailsId, config, diagnosticDir) { let configPath = getGeneratedCodeScanningConfigPath(config); - if (!fs17.existsSync(configPath)) { + if (!fs18.existsSync(configPath)) { if (config.successfullyInitialised) { logger2.warning( [ @@ -185331,7 +185373,7 @@ async function writeCodeScanningConfigFile(config, logger2) { logger2.startGroup("Augmented user configuration file contents"); logger2.info(dump(augmentedConfig)); logger2.endGroup(); - fs17.writeFileSync(codeScanningConfigFile, dump(augmentedConfig)); + fs18.writeFileSync(codeScanningConfigFile, dump(augmentedConfig)); return codeScanningConfigFile; } var TRAP_CACHE_SIZE_MB = 1024; @@ -185827,7 +185869,7 @@ function dbIsFinalized(config, language, logger2) { const dbPath = getCodeQLDatabasePath(config, language); try { const dbInfo = load( - fs18.readFileSync(path16.resolve(dbPath, "codeql-database.yml"), "utf8") + fs19.readFileSync(path16.resolve(dbPath, "codeql-database.yml"), "utf8") ); return !("inProgress" in dbInfo); } catch { @@ -185911,8 +185953,8 @@ function writeDiffRangeDataExtensionPack(logger2, ranges, checkoutPath) { ranges = [{ path: "", startLine: 0, endLine: 0 }]; } const diffRangeDir = path16.join(getTemporaryDirectory(), "pr-diff-range"); - fs18.mkdirSync(diffRangeDir, { recursive: true }); - fs18.writeFileSync( + fs19.mkdirSync(diffRangeDir, { recursive: true }); + fs19.writeFileSync( path16.join(diffRangeDir, "qlpack.yml"), ` name: codeql-action/pr-diff-range @@ -185929,7 +185971,7 @@ dataExtensions: checkoutPath ); const extensionFilePath = path16.join(diffRangeDir, "pr-diff-range.yml"); - fs18.writeFileSync(extensionFilePath, extensionContents); + fs19.writeFileSync(extensionFilePath, extensionContents); logger2.debug( `Wrote pr-diff-range extension pack to ${extensionFilePath}: ${extensionContents}` @@ -186074,7 +186116,7 @@ async function runQueries(sarifFolder, memoryFlag, threadsFlag, diffRangePackDir } function getPerQueryAlertCounts(sarifPath) { const sarifObject = JSON.parse( - fs18.readFileSync(sarifPath, "utf8") + fs19.readFileSync(sarifPath, "utf8") ); const perQueryAlertCounts = {}; for (const sarifRun of sarifObject.runs) { @@ -186092,13 +186134,13 @@ async function runQueries(sarifFolder, memoryFlag, threadsFlag, diffRangePackDir } async function runFinalize(features, outputDir, threadsFlag, memoryFlag, codeql, config, logger2) { try { - await fs18.promises.rm(outputDir, { force: true, recursive: true }); + await fs19.promises.rm(outputDir, { force: true, recursive: true }); } catch (error3) { if (error3?.code !== "ENOENT") { throw error3; } } - await fs18.promises.mkdir(outputDir, { recursive: true }); + await fs19.promises.mkdir(outputDir, { recursive: true }); const timings = await finalizeDatabaseCreation( codeql, features, @@ -186142,7 +186184,7 @@ async function warnIfGoInstalledAfterInit(config, logger2) { } // src/database-upload.ts -var fs19 = __toESM(require("fs")); +var fs20 = __toESM(require("fs")); async function cleanupAndUploadDatabases(action, repositoryNwo, codeql, config, apiDetails, checkoutPath) { const logger2 = action.logger; if (getRequiredInput("upload-database") !== "true") { @@ -186179,7 +186221,7 @@ async function cleanupAndUploadDatabases(action, repositoryNwo, codeql, config, const bundledDb = await bundleDb(config, language, codeql, language, { includeDiagnostics: false }); - bundledDbSize = fs19.statSync(bundledDb).size; + bundledDbSize = fs20.statSync(bundledDb).size; const commitOid = await getCommitOid(action.env, checkoutPath); const maxAttempts = 4; let uploadDurationMs; @@ -186257,7 +186299,7 @@ async function recordClearCleanupSizes(codeql, config, reports, logger2) { const bundledDb = await bundleDb(config, language, codeql, language, { includeDiagnostics: false }); - report.clear_cleanup_zipped_size_bytes = fs19.statSync(bundledDb).size; + report.clear_cleanup_zipped_size_bytes = fs20.statSync(bundledDb).size; logger2.debug( `Database for ${language} is ${report.clear_cleanup_zipped_size_bytes} bytes zipped at the '${"clear" /* Clear */}' cleanup level (vs. ${report.zipped_upload_size_bytes ?? "unknown"} bytes at the '${"overlay" /* Overlay */}' level).` ); @@ -186280,7 +186322,7 @@ async function uploadBundledDatabase(repositoryNwo, language, commitOid, bundled if (uploadsBaseUrl.endsWith("/")) { uploadsBaseUrl = uploadsBaseUrl.slice(0, -1); } - const bundledDbReadStream = fs19.createReadStream(bundledDb); + const bundledDbReadStream = fs20.createReadStream(bundledDb); try { const startTime = performance.now(); await client.request( @@ -186332,7 +186374,7 @@ __export(upload_lib_exports, { waitForProcessing: () => waitForProcessing, writePostProcessedFiles: () => writePostProcessedFiles }); -var fs23 = __toESM(require("fs")); +var fs24 = __toESM(require("fs")); var path19 = __toESM(require("path")); var url = __toESM(require("url")); var import_zlib = __toESM(require("zlib")); @@ -186340,7 +186382,7 @@ var core13 = __toESM(require_core()); var jsonschema2 = __toESM(require_lib2()); // src/fingerprints.ts -var fs20 = __toESM(require("fs")); +var fs21 = __toESM(require("fs")); var import_path4 = __toESM(require("path")); // node_modules/long/index.js @@ -187328,7 +187370,7 @@ async function hash(callback, filepath) { } updateHash(current); }; - const readStream = fs20.createReadStream(filepath, "utf8"); + const readStream = fs21.createReadStream(filepath, "utf8"); for await (const data of readStream) { for (let i = 0; i < data.length; ++i) { processCharacter(data.charCodeAt(i)); @@ -187403,11 +187445,11 @@ function resolveUriToFile(location, artifacts, sourceRoot, logger2) { if (!import_path4.default.isAbsolute(uri)) { uri = srcRootPrefix + uri; } - if (!fs20.existsSync(uri)) { + if (!fs21.existsSync(uri)) { logger2.debug(`Unable to compute fingerprint for non-existent file: ${uri}`); return void 0; } - if (fs20.statSync(uri).isDirectory()) { + if (fs21.statSync(uri).isDirectory()) { logger2.debug(`Unable to compute fingerprint for directory: ${uri}`); return void 0; } @@ -187462,7 +187504,7 @@ async function addFingerprints(sarifLog, sourceRoot, logger2) { } // src/init.ts -var fs21 = __toESM(require("fs")); +var fs22 = __toESM(require("fs")); var path18 = __toESM(require("path")); var toolrunner4 = __toESM(require_toolrunner()); var github3 = __toESM(require_github()); @@ -187497,7 +187539,7 @@ async function initConfig2(actionState, inputs) { }); } async function runDatabaseInitCluster(databaseInitEnvironment, codeql, config, sourceRoot, processName, qlconfigFile) { - fs21.mkdirSync(config.dbLocation, { recursive: true }); + fs22.mkdirSync(config.dbLocation, { recursive: true }); await wrapEnvironment( databaseInitEnvironment, async () => await codeql.databaseInitCluster( @@ -187532,24 +187574,24 @@ async function checkPacksForOverlayCompatibility(codeql, config, logger2) { function checkPackForOverlayCompatibility(packDir, codeQlOverlayVersion, logger2) { try { let qlpackPath = path18.join(packDir, "qlpack.yml"); - if (!fs21.existsSync(qlpackPath)) { + if (!fs22.existsSync(qlpackPath)) { qlpackPath = path18.join(packDir, "codeql-pack.yml"); } const qlpackContents = load( - fs21.readFileSync(qlpackPath, "utf8") + fs22.readFileSync(qlpackPath, "utf8") ); if (!qlpackContents.buildMetadata) { return true; } const packInfoPath = path18.join(packDir, ".packinfo"); - if (!fs21.existsSync(packInfoPath)) { + if (!fs22.existsSync(packInfoPath)) { logger2.warning( `The query pack at ${packDir} does not have a .packinfo file, so it cannot support overlay analysis. Recompiling the query pack with the latest CodeQL CLI should solve this problem.` ); return false; } const packInfoFileContents = JSON.parse( - fs21.readFileSync(packInfoPath, "utf8") + fs22.readFileSync(packInfoPath, "utf8") ); const packOverlayVersion = packInfoFileContents.overlayVersion; if (typeof packOverlayVersion !== "number") { @@ -187584,8 +187626,8 @@ async function checkInstallPython311(languages, codeql) { ]).exec(); } } -function cleanupDatabaseClusterDirectory(config, logger2, options = {}, rmSync5 = fs21.rmSync) { - if (fs21.existsSync(config.dbLocation) && (fs21.statSync(config.dbLocation).isFile() || fs21.readdirSync(config.dbLocation).length > 0)) { +function cleanupDatabaseClusterDirectory(config, logger2, options = {}, rmSync5 = fs22.rmSync) { + if (fs22.existsSync(config.dbLocation) && (fs22.statSync(config.dbLocation).isFile() || fs22.readdirSync(config.dbLocation).length > 0)) { if (!options.disableExistingDirectoryWarning) { logger2.warning( `The database cluster directory ${config.dbLocation} must be empty. Attempting to clean it up.` @@ -187690,7 +187732,7 @@ To opt out of this change, ${envVarOptOut}`; } // src/sarif/index.ts -var fs22 = __toESM(require("fs")); +var fs23 = __toESM(require("fs")); var InvalidSarifUploadError = class extends Error { }; function getToolNames(sarifFile) { @@ -187706,7 +187748,7 @@ function getToolNames(sarifFile) { } function readSarifFile(sarifFilePath) { try { - return JSON.parse(fs22.readFileSync(sarifFilePath, "utf8")); + return JSON.parse(fs23.readFileSync(sarifFilePath, "utf8")); } catch (err) { throw new Error( `Parsing SARIF file at '${sarifFilePath}' failed: ${getErrorMessage(err)}` @@ -187847,8 +187889,8 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo codeQL = initCodeQLResult.codeql; } const baseTempDir = path19.resolve(tempDir, "combined-sarif"); - fs23.mkdirSync(baseTempDir, { recursive: true }); - const outputDirectory = fs23.mkdtempSync(path19.resolve(baseTempDir, "output-")); + fs24.mkdirSync(baseTempDir, { recursive: true }); + const outputDirectory = fs24.mkdtempSync(path19.resolve(baseTempDir, "output-")); const outputFile = path19.resolve(outputDirectory, "combined-sarif.sarif"); await codeQL.mergeResults(sarifFiles, outputFile, { mergeRunsFromEqualCategory: true @@ -187893,7 +187935,7 @@ async function uploadPayload(payload, repositoryNwo, logger2, analysis) { `SARIF upload disabled by an environment variable. Saving to ${payloadSaveFile}` ); logger2.info(`Payload: ${JSON.stringify(payload, null, 2)}`); - fs23.writeFileSync(payloadSaveFile, JSON.stringify(payload, null, 2)); + fs24.writeFileSync(payloadSaveFile, JSON.stringify(payload, null, 2)); return "dummy-sarif-id"; } const client = getApiClient(); @@ -187927,7 +187969,7 @@ async function uploadPayload(payload, repositoryNwo, logger2, analysis) { function findSarifFilesInDir(sarifPath, isSarif) { const sarifFiles = []; const walkSarifFiles = (dir) => { - const entries = fs23.readdirSync(dir, { withFileTypes: true }); + const entries = fs24.readdirSync(dir, { withFileTypes: true }); for (const entry of entries) { if (entry.isFile() && isSarif(entry.name)) { sarifFiles.push(path19.resolve(dir, entry.name)); @@ -187940,11 +187982,11 @@ function findSarifFilesInDir(sarifPath, isSarif) { return sarifFiles; } function getSarifFilePaths(sarifPath, isSarif) { - if (!fs23.existsSync(sarifPath)) { + if (!fs24.existsSync(sarifPath)) { throw new ConfigurationError(`Path does not exist: ${sarifPath}`); } let sarifFiles; - if (fs23.lstatSync(sarifPath).isDirectory()) { + if (fs24.lstatSync(sarifPath).isDirectory()) { sarifFiles = findSarifFilesInDir(sarifPath, isSarif); if (sarifFiles.length === 0) { throw new ConfigurationError( @@ -187957,7 +187999,7 @@ function getSarifFilePaths(sarifPath, isSarif) { return sarifFiles; } async function getGroupedSarifFilePaths(logger2, sarifPath) { - const stats = fs23.statSync(sarifPath, { throwIfNoEntry: false }); + const stats = fs24.statSync(sarifPath, { throwIfNoEntry: false }); if (stats === void 0) { throw new ConfigurationError(`Path does not exist: ${sarifPath}`); } @@ -188092,7 +188134,7 @@ function buildPayload(commitOid, ref, analysisKey, analysisName, zippedSarif, wo payloadObj.base_sha = mergeBaseCommitOid; } else if (process.env.GITHUB_EVENT_PATH) { const githubEvent = JSON.parse( - fs23.readFileSync(process.env.GITHUB_EVENT_PATH, "utf8") + fs24.readFileSync(process.env.GITHUB_EVENT_PATH, "utf8") ); payloadObj.base_ref = `refs/heads/${githubEvent.pull_request.base.ref}`; payloadObj.base_sha = githubEvent.pull_request.base.sha; @@ -188230,9 +188272,9 @@ async function uploadPostProcessedFiles(logger2, checkoutPath, uploadTarget, pos }; } function dumpSarifFile(sarifPayload, outputDir, logger2, uploadTarget) { - if (!fs23.existsSync(outputDir)) { - fs23.mkdirSync(outputDir, { recursive: true }); - } else if (!fs23.lstatSync(outputDir).isDirectory()) { + if (!fs24.existsSync(outputDir)) { + fs24.mkdirSync(outputDir, { recursive: true }); + } else if (!fs24.lstatSync(outputDir).isDirectory()) { throw new ConfigurationError( `The path that processed SARIF files should be written to exists, but is not a directory: ${outputDir}` ); @@ -188242,7 +188284,7 @@ function dumpSarifFile(sarifPayload, outputDir, logger2, uploadTarget) { `upload${uploadTarget.sarifExtension}` ); logger2.info(`Writing processed SARIF file to ${outputFile}`); - fs23.writeFileSync(outputFile, sarifPayload); + fs24.writeFileSync(outputFile, sarifPayload); } var STATUS_CHECK_INITIAL_BACKOFF_MILLISECONDS = 5 * 1e3; var STATUS_CHECK_BACKOFF_MULTIPLIER = 2; @@ -188488,7 +188530,7 @@ function doesGoExtractionOutputExist(config) { "trap", "go" /* go */ ); - return fs24.existsSync(trapDirectory) && fs24.readdirSync(trapDirectory).some( + return fs25.existsSync(trapDirectory) && fs25.readdirSync(trapDirectory).some( (fileName) => [ ".trap", ".trap.gz", @@ -188784,18 +188826,18 @@ async function runWrapper() { } // src/analyze-action-post.ts -var fs28 = __toESM(require("fs")); +var fs29 = __toESM(require("fs")); var core16 = __toESM(require_core()); // src/debug-artifacts.ts -var fs27 = __toESM(require("fs")); +var fs28 = __toESM(require("fs")); var path23 = __toESM(require("path")); var artifact = __toESM(require_artifact2()); var artifactLegacy = __toESM(require_artifact_client2()); var core15 = __toESM(require_core()); // node_modules/archiver/lib/core.js -var import_fs = require("fs"); +var import_fs2 = require("fs"); // node_modules/is-stream/index.js function isStream(stream2, { checkOpen = true } = {}) { @@ -188803,7 +188845,7 @@ function isStream(stream2, { checkOpen = true } = {}) { } // node_modules/readdir-glob/dist/index.mjs -var fs25 = __toESM(require("fs"), 1); +var fs26 = __toESM(require("fs"), 1); var import_events = require("events"); // node_modules/readdir-glob/node_modules/balanced-match/dist/esm/index.js @@ -190680,7 +190722,7 @@ minimatch.unescape = unescape2; var import_path6 = require("path"); function readdir2(dir, strict) { return new Promise((resolve$1, reject) => { - fs25.readdir(dir, { withFileTypes: true }, (err, files) => { + fs26.readdir(dir, { withFileTypes: true }, (err, files) => { if (err) switch (err.code) { case "ENOTDIR": if (strict) reject(err); @@ -190703,7 +190745,7 @@ function readdir2(dir, strict) { } function getStat(file, followSymlinks) { return new Promise((resolve$1) => { - const statFunc = followSymlinks ? fs25.stat : fs25.lstat; + const statFunc = followSymlinks ? fs26.stat : fs26.lstat; statFunc(file, (err, stats) => { if (err) switch (err.code) { case "ENOENT": @@ -190873,7 +190915,7 @@ var import_async = __toESM(require_async(), 1); var import_path7 = require("path"); // node_modules/archiver/lib/error.js -var import_util37 = __toESM(require("util"), 1); +var import_util38 = __toESM(require("util"), 1); var ERROR_CODES = { ABORTED: "archive was aborted", DIRECTORYDIRPATHREQUIRED: "diretory dirpath argument must be a non-empty string value", @@ -190898,7 +190940,7 @@ function ArchiverError(code, data) { this.code = code; this.data = data; } -import_util37.default.inherits(ArchiverError, Error); +import_util38.default.inherits(ArchiverError, Error); // node_modules/archiver/lib/core.js var import_readable_stream2 = __toESM(require_ours(), 1); @@ -191011,7 +191053,7 @@ var Archiver = class extends import_readable_stream2.Transform { data.sourcePath = filepath; task.data = data; this._entriesCount++; - if (data.stats && data.stats instanceof import_fs.Stats) { + if (data.stats && data.stats instanceof import_fs2.Stats) { task = this._updateQueueTaskWithStats(task, data.stats); if (task) { if (data.stats.size) { @@ -191259,7 +191301,7 @@ var Archiver = class extends import_readable_stream2.Transform { callback(); return; } - (0, import_fs.lstat)( + (0, import_fs2.lstat)( task.filepath, function(err, stats) { if (this._state.aborted) { @@ -191321,7 +191363,7 @@ var Archiver = class extends import_readable_stream2.Transform { task.data.type = "file"; task.data.sourceType = "stream"; task.source = new import_lazystream.Readable(function() { - return (0, import_fs.createReadStream)(task.filepath); + return (0, import_fs2.createReadStream)(task.filepath); }); } else if (stats.isDirectory() && this._supportsDirectory) { task.data.name = trailingSlashIt(task.data.name); @@ -191330,7 +191372,7 @@ var Archiver = class extends import_readable_stream2.Transform { task.data.sourceType = "buffer"; task.source = Buffer.concat([]); } else if (stats.isSymbolicLink() && this._supportsSymlink) { - const linkPath = (0, import_fs.readlinkSync)(task.filepath); + const linkPath = (0, import_fs2.readlinkSync)(task.filepath); const dirName = (0, import_path7.dirname)(task.filepath); task.data.type = "symlink"; task.data.linkname = (0, import_path7.relative)( @@ -193173,7 +193215,7 @@ var ZipArchive = class extends Archiver { }; // src/artifact-scanner.ts -var fs26 = __toESM(require("fs")); +var fs27 = __toESM(require("fs")); var os7 = __toESM(require("os")); var path22 = __toESM(require("path")); var exec = __toESM(require_exec()); @@ -193220,7 +193262,7 @@ function isAuthToken(value, patterns = GITHUB_TOKEN_PATTERNS) { function scanFileForTokens(filePath, relativePath2, logger2) { const findings = []; try { - const content = fs26.readFileSync(filePath, "utf8"); + const content = fs27.readFileSync(filePath, "utf8"); for (const { type, pattern } of GITHUB_TOKEN_PATTERNS) { const matches = content.match(pattern); if (matches) { @@ -193253,7 +193295,7 @@ async function scanArchiveFile(archivePath, relativeArchivePath, extractDir, log findings: [] }; try { - const tempExtractDir = fs26.mkdtempSync( + const tempExtractDir = fs27.mkdtempSync( path22.join(extractDir, `extract-${depth}-`) ); const fileName = path22.basename(archivePath).toLowerCase(); @@ -193287,7 +193329,7 @@ async function scanArchiveFile(archivePath, relativeArchivePath, extractDir, log path22.basename(archivePath, ".gz") ); await exec.exec("gunzip", ["-c", archivePath], { - outStream: fs26.createWriteStream(outputFile), + outStream: fs27.createWriteStream(outputFile), silent: true }); } else if (fileName.endsWith(".zip")) { @@ -193308,7 +193350,7 @@ async function scanArchiveFile(archivePath, relativeArchivePath, extractDir, log ); result.scannedFiles += scanResult.scannedFiles; result.findings.push(...scanResult.findings); - fs26.rmSync(tempExtractDir, { recursive: true, force: true }); + fs27.rmSync(tempExtractDir, { recursive: true, force: true }); } catch (e) { logger2.debug( `Could not extract or scan archive file ${archivePath}: ${getErrorMessage(e)}` @@ -193343,7 +193385,7 @@ async function scanDirectory(dirPath, baseRelativePath, logger2, depth = 0) { scannedFiles: 0, findings: [] }; - const entries = fs26.readdirSync(dirPath, { withFileTypes: true }); + const entries = fs27.readdirSync(dirPath, { withFileTypes: true }); for (const entry of entries) { const fullPath = path22.join(dirPath, entry.name); const relativePath2 = path22.join(baseRelativePath, entry.name); @@ -193378,10 +193420,10 @@ async function scanArtifactsForTokens(filesToScan, logger2) { scannedFiles: 0, findings: [] }; - const tempScanDir = fs26.mkdtempSync(path22.join(os7.tmpdir(), "artifact-scan-")); + const tempScanDir = fs27.mkdtempSync(path22.join(os7.tmpdir(), "artifact-scan-")); try { for (const filePath of filesToScan) { - const stats = fs26.statSync(filePath); + const stats = fs27.statSync(filePath); const fileName = path22.basename(filePath); if (stats.isDirectory()) { const dirResult = await scanDirectory(filePath, fileName, logger2); @@ -193419,7 +193461,7 @@ async function scanArtifactsForTokens(filesToScan, logger2) { } } finally { try { - fs26.rmSync(tempScanDir, { recursive: true, force: true }); + fs27.rmSync(tempScanDir, { recursive: true, force: true }); } catch (e) { logger2.debug( `Could not clean up temporary scan directory: ${getErrorMessage(e)}` @@ -193441,10 +193483,10 @@ async function uploadCombinedSarifArtifacts(logger2, gitHubVariant) { ); const baseTempDir = path23.resolve(tempDir, "combined-sarif"); const toUpload = []; - if (fs27.existsSync(baseTempDir)) { - const outputDirs = fs27.readdirSync(baseTempDir); + if (fs28.existsSync(baseTempDir)) { + const outputDirs = fs28.readdirSync(baseTempDir); for (const outputDir of outputDirs) { - const sarifFiles = fs27.readdirSync(path23.resolve(baseTempDir, outputDir)).filter((f) => path23.extname(f) === ".sarif"); + const sarifFiles = fs28.readdirSync(path23.resolve(baseTempDir, outputDir)).filter((f) => path23.extname(f) === ".sarif"); for (const sarifFile of sarifFiles) { toUpload.push(path23.resolve(baseTempDir, outputDir, sarifFile)); } @@ -193471,17 +193513,17 @@ async function uploadCombinedSarifArtifacts(logger2, gitHubVariant) { function tryPrepareSarifDebugArtifact(config, language, logger2) { try { const analyzeActionOutputDir = process.env["CODEQL_ACTION_SARIF_RESULTS_OUTPUT_DIR" /* SARIF_RESULTS_OUTPUT_DIR */]; - if (analyzeActionOutputDir !== void 0 && fs27.existsSync(analyzeActionOutputDir) && fs27.lstatSync(analyzeActionOutputDir).isDirectory()) { + if (analyzeActionOutputDir !== void 0 && fs28.existsSync(analyzeActionOutputDir) && fs28.lstatSync(analyzeActionOutputDir).isDirectory()) { const sarifFile = path23.resolve( analyzeActionOutputDir, `${language}.sarif` ); - if (fs27.existsSync(sarifFile)) { + if (fs28.existsSync(sarifFile)) { const sarifInDbLocation = path23.resolve( config.dbLocation, `${language}.sarif` ); - fs27.copyFileSync(sarifFile, sarifInDbLocation); + fs28.copyFileSync(sarifFile, sarifInDbLocation); return sarifInDbLocation; } } @@ -193649,10 +193691,10 @@ async function createPartialDatabaseBundle(config, language) { core15.info( `${config.debugDatabaseName}-${language} is not finalized. Uploading partial database bundle at ${databaseBundlePath}...` ); - if (fs27.existsSync(databaseBundlePath)) { - await fs27.promises.rm(databaseBundlePath, { force: true }); + if (fs28.existsSync(databaseBundlePath)) { + await fs28.promises.rm(databaseBundlePath, { force: true }); } - const output = fs27.createWriteStream(databaseBundlePath); + const output = fs28.createWriteStream(databaseBundlePath); const zip = new ZipArchive(); zip.on("error", (err) => { throw err; @@ -193702,9 +193744,9 @@ async function runWrapper2() { getCsharpTempDependencyDir() ]; for (const tempDependencyDir of tempDependencyDirs) { - if (fs28.existsSync(tempDependencyDir)) { + if (fs29.existsSync(tempDependencyDir)) { try { - fs28.rmSync(tempDependencyDir, { recursive: true }); + fs29.rmSync(tempDependencyDir, { recursive: true }); } catch (error3) { logger2.info( `Failed to remove temporary dependencies directory: ${getErrorMessage(error3)}` @@ -193815,7 +193857,7 @@ async function runWrapper3() { } // src/init-action.ts -var fs30 = __toESM(require("fs")); +var fs31 = __toESM(require("fs")); var path25 = __toESM(require("path")); var core19 = __toESM(require_core()); var io7 = __toESM(require_io()); @@ -193856,46 +193898,41 @@ async function getToolsInput(action, repositoryProperties) { } // src/languages/swift.ts -var SWIFT_TRACED_UNSUPPORTED_MACOS = 27; -var SWIFT_TRACED_UNSUPPORTED_XCODE = 27; -async function checkSwiftCompatibility(action, config, codeql) { +async function checkSwiftCompatibility(config, codeql, macosVersion) { if (!config.languages.includes("swift" /* swift */)) { return; } if (await codeql.supportsFeature("swiftSupportsAllPlatforms" /* SwiftSupportsAllPlatforms */)) { return; } - const version = macOSVersion(action); - if (version === void 0) { + if (macosVersion === void 0) { throw new ConfigurationError( `Swift analysis is only supported on macOS runner images. Please migrate to a macOS runner.` ); } - if (typeof version === "string") { - action.logger.warning( - `Unable to determine version of macOS, got: ${version}` - ); - return; - } - const skipUnsupportedTracedAnalysis = await action.features.getValue( - "skip_unsupported_traced_analysis" /* SkipUnsupportedTracedAnalysis */ - ); - if (version.major >= SWIFT_TRACED_UNSUPPORTED_MACOS) { - const baseMessage = [ - `Traced Swift analysis is not supported on macOS ${SWIFT_TRACED_UNSUPPORTED_MACOS} or above.`, - `Configure your analysis to run on macOS ${SWIFT_TRACED_UNSUPPORTED_MACOS - 1} or below`, - `and XCode ${SWIFT_TRACED_UNSUPPORTED_XCODE - 1} or below.` - ].join(" "); +} + +// src/languages/traced.ts +var UNSUPPORTED_MACOS_FOR_TRACED = 27; +var UNSUPPORTED_XCODE_FOR_TRACED = 27; +function handleUnsupportedVersion(logger2, config, skipUnsupportedTracedAnalysis, product, version) { + const baseMessage = [ + `Traced analysis is not supported on ${product} ${UNSUPPORTED_MACOS_FOR_TRACED} or above.`, + `Configure your analysis to run on macOS ${UNSUPPORTED_MACOS_FOR_TRACED - 1} or below`, + `and XCode ${UNSUPPORTED_XCODE_FOR_TRACED - 1} or below.` + ].join(" "); + const attributeName = product === "macOS" ? "macOSVersion" : "xcodeVersion"; + for (const language of config.languages) { addDiagnostic( config, - "swift" /* swift */, + language, makeDiagnostic( - "codeql-action/unsupported-traced-swift-analysis-macos", - "Traced Swift analysis is not supported on this version of macOS", + `codeql-action/unsupported-traced-analysis-${product.toLowerCase()}`, + `Traced analysis is not supported on this version of ${product}`, { attributes: { languages: config.languages, - macOSVersion: version.toString() + [attributeName]: version.toString() }, markdownMessage: baseMessage, severity: skipUnsupportedTracedAnalysis ? "error" : "warning", @@ -193907,11 +193944,41 @@ async function checkSwiftCompatibility(action, config, codeql) { } ) ); - if (skipUnsupportedTracedAnalysis) { - throw new ConfigurationError(baseMessage); - } else { - action.logger.warning(baseMessage); - } + } + if (skipUnsupportedTracedAnalysis) { + throw new ConfigurationError(baseMessage); + } else { + logger2.warning(baseMessage); + } +} +async function checkRunnerSupportsTracedAnalysis(action, config, codeql) { + const version = macOSVersion(action); + await checkSwiftCompatibility(config, codeql, version); + const skipUnsupportedTracedAnalysis = await action.features.getValue( + "skip_unsupported_traced_analysis" /* SkipUnsupportedTracedAnalysis */ + ); + if (typeof version === "string") { + action.logger.warning( + `Unable to determine version of macOS, got: ${version}` + ); + } else if (version !== void 0 && version.major >= UNSUPPORTED_MACOS_FOR_TRACED) { + handleUnsupportedVersion( + action.logger, + config, + skipUnsupportedTracedAnalysis, + "macOS", + version + ); + } + const xcodeVer = xcodeVersion(action.logger); + if (xcodeVer !== void 0 && xcodeVer.major >= UNSUPPORTED_XCODE_FOR_TRACED) { + handleUnsupportedVersion( + action.logger, + config, + skipUnsupportedTracedAnalysis, + "Xcode", + xcodeVer + ); } } @@ -193934,7 +194001,7 @@ function createInitToolsDownloadFields(report, toolsFeatureFlagsValid) { } // src/workflow.ts -var fs29 = __toESM(require("fs")); +var fs30 = __toESM(require("fs")); var path24 = __toESM(require("path")); var import_zlib3 = __toESM(require("zlib")); var core18 = __toESM(require_core()); @@ -194086,7 +194153,7 @@ async function getWorkflow(logger2) { ); } const workflowPath = await getWorkflowAbsolutePath(logger2); - return load(fs29.readFileSync(workflowPath, "utf-8")); + return load(fs30.readFileSync(workflowPath, "utf-8")); } async function getWorkflowAbsolutePath(logger2) { const relativePath2 = await getWorkflowRelativePath(); @@ -194094,7 +194161,7 @@ async function getWorkflowAbsolutePath(logger2) { getRequiredEnvParam("GITHUB_WORKSPACE"), relativePath2 ); - if (fs29.existsSync(absolutePath)) { + if (fs30.existsSync(absolutePath)) { logger2.debug( `Derived the following absolute path for the currently executing workflow: ${absolutePath}.` ); @@ -194434,7 +194501,11 @@ async function run3(actionState) { enableFileCoverageInformation: fileCoverageResult.enabled, logger: logger2 }); - await checkSwiftCompatibility(actionStateWithFeatures, config, codeql); + await checkRunnerSupportsTracedAnalysis( + actionStateWithFeatures, + config, + codeql + ); if (repositoryPropertiesResult.isFailure()) { addNoLanguageDiagnostic( config, @@ -194534,16 +194605,16 @@ async function run3(actionState) { "codeql-action-go-tracing", "bin" ); - fs30.mkdirSync(tempBinPath, { recursive: true }); + fs31.mkdirSync(tempBinPath, { recursive: true }); core19.addPath(tempBinPath); const goWrapperPath = path25.resolve(tempBinPath, "go"); - fs30.writeFileSync( + fs31.writeFileSync( goWrapperPath, `#!/bin/bash exec ${goBinaryPath} "$@"` ); - fs30.chmodSync(goWrapperPath, "755"); + fs31.chmodSync(goWrapperPath, "755"); actionState.env.export("CODEQL_ACTION_GO_BINARY" /* GO_BINARY_LOCATION */, goWrapperPath); } catch (e) { logger2.warning( @@ -194726,7 +194797,7 @@ async function runWrapper4() { var core20 = __toESM(require_core()); // src/init-action-post-helper.ts -var fs31 = __toESM(require("fs")); +var fs32 = __toESM(require("fs")); var import_path8 = __toESM(require("path")); var github4 = __toESM(require_github()); function createFailedUploadFailedSarifResult(error3) { @@ -194808,7 +194879,7 @@ async function generateFailedSarif(logger2, features, config, category, checkout let diagnosticDir = getTempDiagnosticsRoot( config.tempDir ); - if (!exportDiagnosticsEnabled || !fs31.existsSync(diagnosticDir)) { + if (!exportDiagnosticsEnabled || !fs32.existsSync(diagnosticDir)) { diagnosticDir = void 0; } await codeql.diagnosticsExport(sarifFile, category, config, diagnosticDir); @@ -194935,7 +195006,7 @@ async function uploadFailureInfo(uploadAllAvailableDebugArtifacts, printDebugLog } if (isSelfHostedRunner() && config.dbLocation) { try { - fs31.rmSync(config.dbLocation, { + fs32.rmSync(config.dbLocation, { recursive: true, force: true, maxRetries: 3 @@ -195875,7 +195946,7 @@ function generateCertificateAuthority() { } // src/start-proxy/environment.ts -var fs32 = __toESM(require("fs")); +var fs33 = __toESM(require("fs")); var path28 = __toESM(require("path")); var toolrunner5 = __toESM(require_toolrunner()); var io8 = __toESM(require_io()); @@ -195948,9 +196019,9 @@ function checkJdkSettings(logger2, jdkHome) { for (const fileToCheck of filesToCheck) { const file = path28.join(jdkHome, fileToCheck); try { - if (fs32.existsSync(file)) { + if (fs33.existsSync(file)) { logger2.debug(`Found '${file}'.`); - const lines = String(fs32.readFileSync(file)).split("\n"); + const lines = String(fs33.readFileSync(file)).split("\n"); for (const line of lines) { for (const property of javaProperties) { if (line.startsWith(`${property}=`)) { diff --git a/src/init-action.ts b/src/init-action.ts index ae793e19b..af95e8ffa 100644 --- a/src/init-action.ts +++ b/src/init-action.ts @@ -62,7 +62,7 @@ import { runDatabaseInitCluster, } from "./init"; import { JavaEnvVars, BuiltInLanguage } from "./languages"; -import { checkSwiftCompatibility } from "./languages/swift"; +import { checkRunnerSupportsTracedAnalysis } from "./languages/traced"; import { Logger, withGroupAsync } from "./logging"; import { downloadOverlayBaseDatabaseFromCache, @@ -419,7 +419,11 @@ async function run( logger, }); - await checkSwiftCompatibility(actionStateWithFeatures, config, codeql); + await checkRunnerSupportsTracedAnalysis( + actionStateWithFeatures, + config, + codeql, + ); if (repositoryPropertiesResult.isFailure()) { addNoLanguageDiagnostic( diff --git a/src/languages/swift.test.ts b/src/languages/swift.test.ts index dd3bca80c..465f782c1 100644 --- a/src/languages/swift.test.ts +++ b/src/languages/swift.test.ts @@ -1,22 +1,17 @@ import test from "ava"; import sinon from "sinon"; -import * as diagnostics from "../diagnostics"; import { ActionsEnvVars } from "../environment"; -import { Feature } from "../feature-flags"; import { - checkExpectedLogMessages, - createFeatures, createTestConfig, getCodeQLForTesting, getTestEnv, - initAllState, makeVersionInfo, RecordingLogger, setupTests, } from "../testing-utils"; import { ToolsFeature } from "../tools-features"; -import { ConfigurationError, withTmpDir } from "../util"; +import { withTmpDir } from "../util"; import { checkSwiftCompatibility } from "./swift"; @@ -33,9 +28,11 @@ test("checkSwiftCompatibility doesn't throw for non-Swift languages", async (t) const codeql = await getCodeQLForTesting(); await t.notThrowsAsync( checkSwiftCompatibility( - initAllState(), createTestConfig({ languages: [language] }), codeql, + // A value of `undefined` should make `isSwiftCompatible` throw for Swift by default + // since it means we are on a platform other than macOS + undefined, ), ); } @@ -55,9 +52,11 @@ test("checkSwiftCompatibility doesn't throw for Swift if CLI supports swiftSuppo await t.notThrowsAsync( checkSwiftCompatibility( - initAllState({ platform: "darwin", env, logger }), createTestConfig({ languages: [BuiltInLanguage.swift] }), codeql, + // A value of `undefined` should make `isSwiftCompatible` throw for Swift by default + // since it means we are on a platform other than macOS + undefined, ), ); @@ -78,183 +77,13 @@ test("checkSwiftCompatibility doesn't throw for Swift on darwin", async (t) => await t.notThrowsAsync( checkSwiftCompatibility( - initAllState({ platform: "darwin", env, logger }), createTestConfig({ tempDir: tmpDir, languages: [BuiltInLanguage.swift], }), codeql, + // A value other than `undefined` means we are on macOS. + "some-macos-version", ), ); })); - -const nonDarwinPlatforms: NodeJS.Platform[] = ["linux", "win32"]; -for (const nonDarwinPlatform of nonDarwinPlatforms) { - test(`checkSwiftCompatibility throws for Swift on ${nonDarwinPlatform}`, async (t) => - withTmpDir(async (tmpDir) => { - const logger = new RecordingLogger(); - const env = getTestEnv(); - env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); - - const codeql = await getCodeQLForTesting( - "codeql-for-testing", - logger, - env, - ); - sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); - - await t.throwsAsync( - checkSwiftCompatibility( - initAllState({ platform: nonDarwinPlatform, env, logger }), - createTestConfig({ languages: [BuiltInLanguage.swift] }), - codeql, - ), - { - instanceOf: ConfigurationError, - message: /^Swift analysis is only supported on macOS runner images/, - }, - ); - })); -} - -test("checkSwiftCompatibility warns if version string is not a semver", async (t) => - withTmpDir(async (tmpDir) => { - const logger = new RecordingLogger(); - const env = getTestEnv(); - env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); - - const codeql = await getCodeQLForTesting("codeql-for-testing", logger, env); - sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); - - await checkSwiftCompatibility( - initAllState({ - logger, - platform: "darwin", - osRelease: "unexpected", - env, - }), - createTestConfig({ languages: [BuiltInLanguage.swift] }), - codeql, - ); - - checkExpectedLogMessages(t, logger.messages, [ - "Unable to determine version of macOS, got: unexpected", - ]); - })); - -// `addDiagnostic` changes global state and we must stub it, so this test must be serial. -test.serial( - "checkSwiftCompatibility logs and adds diagnostic if macOS version is unsupported", - async (t) => - withTmpDir(async (tmpDir) => { - const logger = new RecordingLogger(); - const env = getTestEnv(); - env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); - - const codeql = await getCodeQLForTesting( - "codeql-for-testing", - logger, - env, - ); - sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); - - const addDiagnostic = sinon.stub(diagnostics, "addDiagnostic"); - - const config = createTestConfig({ languages: [BuiltInLanguage.swift] }); - await checkSwiftCompatibility( - initAllState({ - logger, - platform: "darwin", - osRelease: "27.0.0", - env, - }), - config, - codeql, - ); - - checkExpectedLogMessages(t, logger.messages, [ - "Traced Swift analysis is not supported on macOS 27", - ]); - - t.is(addDiagnostic.callCount, 1); - t.like(addDiagnostic.args[0], [ - config, - BuiltInLanguage.swift, - { - attributes: { - languages: [BuiltInLanguage.swift], - macOSVersion: "27.0.0", - }, - severity: "warning", - source: { - id: "codeql-action/unsupported-traced-swift-analysis-macos", - name: "Traced Swift analysis is not supported on this version of macOS", - }, - visibility: { - cliSummaryTable: true, - statusPage: true, - telemetry: true, - }, - } satisfies Partial, - ]); - }), -); - -// `addDiagnostic` changes global state and we must stub it, so this test must be serial. -test.serial( - "checkSwiftCompatibility throws if macOS version is unsupported and FF is enabled", - async (t) => - withTmpDir(async (tmpDir) => { - const logger = new RecordingLogger(); - const env = getTestEnv(); - env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); - - const features = createFeatures([Feature.SkipUnsupportedTracedAnalysis]); - - const codeql = await getCodeQLForTesting( - "codeql-for-testing", - logger, - env, - ); - sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); - - const addDiagnostic = sinon.stub(diagnostics, "addDiagnostic"); - - const config = createTestConfig({ languages: [BuiltInLanguage.swift] }); - await t.throwsAsync( - checkSwiftCompatibility( - initAllState({ - logger, - platform: "darwin", - osRelease: "27.0.0", - env, - features, - }), - config, - codeql, - ), - ); - - t.is(addDiagnostic.callCount, 1); - t.like(addDiagnostic.args[0], [ - config, - BuiltInLanguage.swift, - { - attributes: { - languages: [BuiltInLanguage.swift], - macOSVersion: "27.0.0", - }, - severity: "error", - source: { - id: "codeql-action/unsupported-traced-swift-analysis-macos", - name: "Traced Swift analysis is not supported on this version of macOS", - }, - visibility: { - cliSummaryTable: true, - statusPage: true, - telemetry: true, - }, - } satisfies Partial, - ]); - }), -); diff --git a/src/languages/swift.ts b/src/languages/swift.ts index 30a77eb42..45ca87416 100644 --- a/src/languages/swift.ts +++ b/src/languages/swift.ts @@ -1,32 +1,25 @@ -import { ActionState } from "../action-common"; +import type { SemVer } from "semver"; + import { CodeQL } from "../codeql"; -import { Config } from "../config-utils"; -import { addDiagnostic, makeDiagnostic } from "../diagnostics"; -import { Feature } from "../feature-flags"; -import { macOSVersion } from "../platform"; +import type { ActionConfig } from "../config/action-config"; import { ToolsFeature } from "../tools-features"; import { ConfigurationError } from "../util"; import { BuiltInLanguage } from "."; -/** macOS 27 and above do not support traced extraction for Swift. */ -export const SWIFT_TRACED_UNSUPPORTED_MACOS = 27; - -/** Xcode 27 and above do not support traced extraction for Swift. */ -export const SWIFT_TRACED_UNSUPPORTED_XCODE = 27; - /** * Determines whether we can run a Swift analysis on the current runner. * - * @param action The Action state. * @param config The Action configuration. + * @param codeql The {@link CodeQL} CLI instance. + * @param macosVersion The version of macOS, if any. * * @throws {ConfigurationError} If Swift analysis is not possible on the current runner. */ export async function checkSwiftCompatibility( - action: ActionState<["Base", "Logger", "FeatureFlags"]>, - config: Config, + config: ActionConfig<"languages">, codeql: CodeQL, + macosVersion: SemVer | string | undefined, ) { // The checks are not relevant if we are not trying to analyse Swift. if (!config.languages.includes(BuiltInLanguage.swift)) { @@ -40,64 +33,10 @@ export async function checkSwiftCompatibility( return; } - // Try to get the macOS version. - const version = macOSVersion(action); - - // If `version` is undefined, then we are not on macOS. - if (version === undefined) { + // If `macosVersion` is undefined, then we are not on macOS and Swift analysis is unsupported. + if (macosVersion === undefined) { throw new ConfigurationError( `Swift analysis is only supported on macOS runner images. Please migrate to a macOS runner.`, ); } - // If we got a string, we are on macOS but couldn't parse the version string. - if (typeof version === "string") { - action.logger.warning( - `Unable to determine version of macOS, got: ${version}`, - ); - return; - } - - const skipUnsupportedTracedAnalysis = await action.features.getValue( - Feature.SkipUnsupportedTracedAnalysis, - ); - if (version.major >= SWIFT_TRACED_UNSUPPORTED_MACOS) { - const baseMessage = [ - `Traced Swift analysis is not supported on macOS ${SWIFT_TRACED_UNSUPPORTED_MACOS} or above.`, - `Configure your analysis to run on macOS ${SWIFT_TRACED_UNSUPPORTED_MACOS - 1} or below`, - `and XCode ${SWIFT_TRACED_UNSUPPORTED_XCODE - 1} or below.`, - ].join(" "); - - // Create a diagnostic that will show up on the TSP. - addDiagnostic( - config, - BuiltInLanguage.swift, - makeDiagnostic( - "codeql-action/unsupported-traced-swift-analysis-macos", - "Traced Swift analysis is not supported on this version of macOS", - { - attributes: { - languages: config.languages, - macOSVersion: version.toString(), - }, - markdownMessage: baseMessage, - severity: skipUnsupportedTracedAnalysis ? "error" : "warning", - visibility: { - cliSummaryTable: true, - statusPage: true, - telemetry: true, - }, - }, - ), - ); - - // Throw an error to abort the analysis if the FF is enabled or log the message. - if (skipUnsupportedTracedAnalysis) { - // ConfigurationErrors are converted to the "aborted" status by the exception handler - // in `init-action.ts` that guards the call to `isSwiftCompatible`. - throw new ConfigurationError(baseMessage); - } else { - // This will also show up as a workflow annotation. - action.logger.warning(baseMessage); - } - } } diff --git a/src/languages/traced.test.ts b/src/languages/traced.test.ts new file mode 100644 index 000000000..74afef5dd --- /dev/null +++ b/src/languages/traced.test.ts @@ -0,0 +1,390 @@ +import fs from "fs"; + +import test from "ava"; +import * as sinon from "sinon"; + +import * as diagnostics from "../diagnostics"; +import { ActionsEnvVars } from "../environment"; +import { Feature } from "../feature-flags"; +import { XCODE_SELECT_LINK_PATH } from "../platform"; +import { + checkExpectedLogMessages, + checkUnexpectedLogMessages, + createFeatures, + createTestConfig, + getCodeQLForTesting, + getTestEnv, + initAllState, + makeVersionInfo, + RecordingLogger, + setupTests, +} from "../testing-utils"; +import { ConfigurationError, withTmpDir } from "../util"; + +import { checkRunnerSupportsTracedAnalysis } from "./traced"; + +import { BuiltInLanguage } from "."; + +setupTests(test); + +const nonDarwinPlatforms: NodeJS.Platform[] = ["linux", "win32"]; +for (const nonDarwinPlatform of nonDarwinPlatforms) { + test(`checkRunnerSupportsTracedAnalysis throws for Swift on ${nonDarwinPlatform}`, async (t) => + withTmpDir(async (tmpDir) => { + const logger = new RecordingLogger(); + const env = getTestEnv(); + env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); + + const codeql = await getCodeQLForTesting( + "codeql-for-testing", + logger, + env, + ); + sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); + + await t.throwsAsync( + checkRunnerSupportsTracedAnalysis( + initAllState({ platform: nonDarwinPlatform, env, logger }), + createTestConfig({ languages: [BuiltInLanguage.swift] }), + codeql, + ), + { + instanceOf: ConfigurationError, + message: /^Swift analysis is only supported on macOS runner images/, + }, + ); + })); +} + +test("checkRunnerSupportsTracedAnalysis warns if version string is not a semver", async (t) => + withTmpDir(async (tmpDir) => { + const logger = new RecordingLogger(); + const env = getTestEnv(); + env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); + + const codeql = await getCodeQLForTesting("codeql-for-testing", logger, env); + sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); + + await checkRunnerSupportsTracedAnalysis( + initAllState({ + logger, + platform: "darwin", + osRelease: "unexpected", + env, + }), + createTestConfig({ languages: [BuiltInLanguage.go] }), + codeql, + ); + + checkExpectedLogMessages(t, logger.messages, [ + "Unable to determine version of macOS, got: unexpected", + ]); + })); + +// `addDiagnostic` changes global state and we must stub it, so this test must be serial. +test.serial( + "checkRunnerSupportsTracedAnalysis logs and adds diagnostic if macOS version is unsupported", + async (t) => + withTmpDir(async (tmpDir) => { + const logger = new RecordingLogger(); + const env = getTestEnv(); + env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); + + const codeql = await getCodeQLForTesting( + "codeql-for-testing", + logger, + env, + ); + sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); + + const addDiagnostic = sinon.stub(diagnostics, "addDiagnostic"); + + const config = createTestConfig({ languages: [BuiltInLanguage.swift] }); + await checkRunnerSupportsTracedAnalysis( + initAllState({ + logger, + platform: "darwin", + osRelease: "27.0.0", + env, + }), + config, + codeql, + ); + + checkExpectedLogMessages(t, logger.messages, [ + "Traced analysis is not supported on macOS 27", + ]); + + t.is(addDiagnostic.callCount, 1); + t.like(addDiagnostic.args[0], [ + config, + BuiltInLanguage.swift, + { + attributes: { + languages: [BuiltInLanguage.swift], + macOSVersion: "27.0.0", + }, + severity: "warning", + source: { + id: "codeql-action/unsupported-traced-analysis-macos", + name: "Traced analysis is not supported on this version of macOS", + }, + visibility: { + cliSummaryTable: true, + statusPage: true, + telemetry: true, + }, + } satisfies Partial, + ]); + }), +); + +// `addDiagnostic` changes global state and we must stub it, so this test must be serial. +test.serial( + "checkRunnerSupportsTracedAnalysis throws if macOS version is unsupported and FF is enabled", + async (t) => + withTmpDir(async (tmpDir) => { + const logger = new RecordingLogger(); + const env = getTestEnv(); + env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); + + const features = createFeatures([Feature.SkipUnsupportedTracedAnalysis]); + + const codeql = await getCodeQLForTesting( + "codeql-for-testing", + logger, + env, + ); + sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); + + const addDiagnostic = sinon.stub(diagnostics, "addDiagnostic"); + + const config = createTestConfig({ languages: [BuiltInLanguage.swift] }); + await t.throwsAsync( + checkRunnerSupportsTracedAnalysis( + initAllState({ + logger, + platform: "darwin", + osRelease: "27.0.0", + env, + features, + }), + config, + codeql, + ), + ); + + t.is(addDiagnostic.callCount, 1); + t.like(addDiagnostic.args[0], [ + config, + BuiltInLanguage.swift, + { + attributes: { + languages: [BuiltInLanguage.swift], + macOSVersion: "27.0.0", + }, + severity: "error", + source: { + id: "codeql-action/unsupported-traced-analysis-macos", + name: "Traced analysis is not supported on this version of macOS", + }, + visibility: { + cliSummaryTable: true, + statusPage: true, + telemetry: true, + }, + } satisfies Partial, + ]); + }), +); + +// `addDiagnostic` changes global state and we must stub it, so this test must be serial. +test.serial( + "checkRunnerSupportsTracedAnalysis doesn't add a diagnostic if Xcode version is supported", + async (t) => + withTmpDir(async (tmpDir) => { + const logger = new RecordingLogger(); + const env = getTestEnv(); + env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); + + const statSync = sinon + .stub(fs, "statSync") + .returns({ isSymbolicLink: () => true } as fs.Stats); + const readlinkSync = sinon + .stub(fs, "readlinkSync") + .returns("/Applications/Xcode_26.0.app/Contents/Developer"); + + const codeql = await getCodeQLForTesting( + "codeql-for-testing", + logger, + env, + ); + sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); + + const addDiagnostic = sinon.stub(diagnostics, "addDiagnostic"); + + const config = createTestConfig({ languages: [BuiltInLanguage.swift] }); + await checkRunnerSupportsTracedAnalysis( + initAllState({ + logger, + platform: "darwin", + osRelease: "26.0.0", + env, + }), + config, + codeql, + ); + + t.is(statSync.callCount, 1); + t.deepEqual(statSync.args[0], [XCODE_SELECT_LINK_PATH]); + t.is(readlinkSync.callCount, 1); + t.deepEqual(readlinkSync.args[0], [XCODE_SELECT_LINK_PATH]); + + checkUnexpectedLogMessages(t, logger.messages, [ + "Traced analysis is not supported on Xcode 27", + ]); + + t.is(addDiagnostic.callCount, 0); + }), +); + +// `addDiagnostic` changes global state and we must stub it, so this test must be serial. +test.serial( + "checkRunnerSupportsTracedAnalysis logs and adds diagnostic if Xcode version is unsupported", + async (t) => + withTmpDir(async (tmpDir) => { + const logger = new RecordingLogger(); + const env = getTestEnv(); + env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); + + const statSync = sinon + .stub(fs, "statSync") + .returns({ isSymbolicLink: () => true } as fs.Stats); + const readlinkSync = sinon + .stub(fs, "readlinkSync") + .returns("/Applications/Xcode_27.0.app/Contents/Developer"); + + const codeql = await getCodeQLForTesting( + "codeql-for-testing", + logger, + env, + ); + sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); + + const addDiagnostic = sinon.stub(diagnostics, "addDiagnostic"); + + const config = createTestConfig({ languages: [BuiltInLanguage.swift] }); + await checkRunnerSupportsTracedAnalysis( + initAllState({ + logger, + platform: "darwin", + osRelease: "26.0.0", + env, + }), + config, + codeql, + ); + + t.is(statSync.callCount, 1); + t.deepEqual(statSync.args[0], [XCODE_SELECT_LINK_PATH]); + t.is(readlinkSync.callCount, 1); + t.deepEqual(readlinkSync.args[0], [XCODE_SELECT_LINK_PATH]); + + checkExpectedLogMessages(t, logger.messages, [ + "Traced analysis is not supported on Xcode 27", + ]); + + t.is(addDiagnostic.callCount, 1); + t.like(addDiagnostic.args[0], [ + config, + BuiltInLanguage.swift, + { + attributes: { + languages: [BuiltInLanguage.swift], + xcodeVersion: "27.0.0", + }, + severity: "warning", + source: { + id: "codeql-action/unsupported-traced-analysis-xcode", + name: "Traced analysis is not supported on this version of Xcode", + }, + visibility: { + cliSummaryTable: true, + statusPage: true, + telemetry: true, + }, + } satisfies Partial, + ]); + }), +); + +// `addDiagnostic` changes global state and we must stub it, so this test must be serial. +test.serial( + "checkRunnerSupportsTracedAnalysis throws if Xcode version is unsupported and FF is enabled", + async (t) => + withTmpDir(async (tmpDir) => { + const logger = new RecordingLogger(); + const env = getTestEnv(); + env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); + + const statSync = sinon + .stub(fs, "statSync") + .returns({ isSymbolicLink: () => true } as fs.Stats); + const readlinkSync = sinon + .stub(fs, "readlinkSync") + .returns("/Applications/Xcode_27.0.app/Contents/Developer"); + + const features = createFeatures([Feature.SkipUnsupportedTracedAnalysis]); + + const codeql = await getCodeQLForTesting( + "codeql-for-testing", + logger, + env, + ); + sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); + + const addDiagnostic = sinon.stub(diagnostics, "addDiagnostic"); + + const config = createTestConfig({ languages: [BuiltInLanguage.swift] }); + await t.throwsAsync( + checkRunnerSupportsTracedAnalysis( + initAllState({ + logger, + platform: "darwin", + osRelease: "26.0.0", + env, + features, + }), + config, + codeql, + ), + ); + + t.is(statSync.callCount, 1); + t.deepEqual(statSync.args[0], [XCODE_SELECT_LINK_PATH]); + t.is(readlinkSync.callCount, 1); + t.deepEqual(readlinkSync.args[0], [XCODE_SELECT_LINK_PATH]); + + t.is(addDiagnostic.callCount, 1); + t.like(addDiagnostic.args[0], [ + config, + BuiltInLanguage.swift, + { + attributes: { + languages: [BuiltInLanguage.swift], + xcodeVersion: "27.0.0", + }, + severity: "error", + source: { + id: "codeql-action/unsupported-traced-analysis-xcode", + name: "Traced analysis is not supported on this version of Xcode", + }, + visibility: { + cliSummaryTable: true, + statusPage: true, + telemetry: true, + }, + } satisfies Partial, + ]); + }), +); diff --git a/src/languages/traced.ts b/src/languages/traced.ts new file mode 100644 index 000000000..1d731187b --- /dev/null +++ b/src/languages/traced.ts @@ -0,0 +1,134 @@ +import * as semver from "semver"; + +import type { ActionState, Logger } from "../action-common"; +import type { CodeQL } from "../codeql"; +import type { ActionConfig } from "../config/action-config"; +import { addDiagnostic, makeDiagnostic } from "../diagnostics"; +import { Feature } from "../feature-flags"; +import { macOSVersion, xcodeVersion } from "../platform"; +import { ConfigurationError } from "../util"; + +import { checkSwiftCompatibility } from "./swift"; + +/** macOS 27 and above do not support traced extraction. */ +export const UNSUPPORTED_MACOS_FOR_TRACED = 27; + +/** Xcode 27 and above do not support traced extraction. */ +export const UNSUPPORTED_XCODE_FOR_TRACED = 27; + +/** + * Creates a diagnostic indicating that `version` of `product` is unsupported for traced analysis. + * Depending on `skipUnsupportedTracedAnalysis`, this function then either throws a {@link ConfigurationError} + * or logs the problem as a warning. + * + * @param logger The logger to use. + * @param config The CodeQL Action configuration. + * @param skipUnsupportedTracedAnalysis Whether this is a fatal error. + * @param product The product that the version is unsupported of. + * @param version The unsupported version. + */ +function handleUnsupportedVersion( + logger: Logger, + config: ActionConfig<"languages" | "dbLocation" | "tempDir">, + skipUnsupportedTracedAnalysis: boolean, + product: "macOS" | "Xcode", + version: semver.SemVer, +) { + const baseMessage = [ + `Traced analysis is not supported on ${product} ${UNSUPPORTED_MACOS_FOR_TRACED} or above.`, + `Configure your analysis to run on macOS ${UNSUPPORTED_MACOS_FOR_TRACED - 1} or below`, + `and XCode ${UNSUPPORTED_XCODE_FOR_TRACED - 1} or below.`, + ].join(" "); + + const attributeName = product === "macOS" ? "macOSVersion" : "xcodeVersion"; + + // Create a diagnostic that will show up on the TSP. + for (const language of config.languages) { + addDiagnostic( + config, + language, + makeDiagnostic( + `codeql-action/unsupported-traced-analysis-${product.toLowerCase()}`, + `Traced analysis is not supported on this version of ${product}`, + { + attributes: { + languages: config.languages, + [attributeName]: version.toString(), + }, + markdownMessage: baseMessage, + severity: skipUnsupportedTracedAnalysis ? "error" : "warning", + visibility: { + cliSummaryTable: true, + statusPage: true, + telemetry: true, + }, + }, + ), + ); + } + + // Throw an error to abort the analysis if the FF is enabled or log the message. + if (skipUnsupportedTracedAnalysis) { + // ConfigurationErrors are converted to the "aborted" status by the exception handler + // in `init-action.ts` that guards the call to `checkRunnerSupportsTracedAnalysis`. + throw new ConfigurationError(baseMessage); + } else { + // This will also show up as a workflow annotation. + logger.warning(baseMessage); + } +} + +/** + * Determines whether we can run a traced analysis on the current runner. + * + * @throws {ConfigurationError} If traced analysis is not possible on the current runner. + */ +export async function checkRunnerSupportsTracedAnalysis( + action: ActionState<["Base", "Logger", "FeatureFlags"]>, + config: ActionConfig<"languages" | "dbLocation" | "tempDir">, + codeql: CodeQL, +) { + // Try to get the macOS version. + const version = macOSVersion(action); + + // Perform some initial, Swift-specific checks. + await checkSwiftCompatibility(config, codeql, version); + + const skipUnsupportedTracedAnalysis = await action.features.getValue( + Feature.SkipUnsupportedTracedAnalysis, + ); + if (typeof version === "string") { + // If we got a string, we are on macOS but couldn't parse the version string. + action.logger.warning( + `Unable to determine version of macOS, got: ${version}`, + ); + } else if ( + version !== undefined && + version.major >= UNSUPPORTED_MACOS_FOR_TRACED + ) { + handleUnsupportedVersion( + action.logger, + config, + skipUnsupportedTracedAnalysis, + "macOS", + version, + ); + } + + // Determining whether the Xcode version is supported only makes sense on macOS, so we only do it + // after determining that we are running on macOS. + const xcodeVer = xcodeVersion(action.logger); + + if ( + xcodeVer !== undefined && + xcodeVer.major >= UNSUPPORTED_XCODE_FOR_TRACED + ) { + handleUnsupportedVersion( + action.logger, + config, + skipUnsupportedTracedAnalysis, + "Xcode", + xcodeVer, + ); + } +}