diff --git a/dist/index.js b/dist/index.js index 05c42e9..29285fa 100644 --- a/dist/index.js +++ b/dist/index.js @@ -120,7 +120,7 @@ ${fileData}`); } // src/actions-core-platform.ts -import * as core from "@actions/core"; +import * as actionsCore from "@actions/core"; import * as exec from "@actions/exec"; import os2 from "os"; var getWindowsInfo = async () => { @@ -158,9 +158,9 @@ var getLinuxInfo = async () => { let data = {}; try { data = releaseInfo({ mode: "sync" }); - console.log(data); + actionsCore.debug(`Identified release info: ${JSON.stringify(data)}`); } catch (e) { - core.debug(`Error collecting release info: ${e}`); + actionsCore.debug(`Error collecting release info: ${e}`); } return { name: getPropertyViaWithDefault( @@ -211,7 +211,7 @@ async function getDetails() { } // src/correlation.ts -import * as actionsCore from "@actions/core"; +import * as actionsCore2 from "@actions/core"; import { createHash } from "node:crypto"; var OPTIONAL_VARIABLES = ["INVOCATION_ID"]; function identify(projectName) { @@ -274,8 +274,8 @@ function identify(projectName) { ]) } }; - actionsCore.debug("Correlation data:"); - actionsCore.debug(JSON.stringify(ident, null, 2)); + actionsCore2.debug("Correlation data:"); + actionsCore2.debug(JSON.stringify(ident, null, 2)); return ident; } function hashEnvironmentVariables(prefix, variables) { @@ -284,12 +284,12 @@ function hashEnvironmentVariables(prefix, variables) { let value = process.env[varName]; if (value === void 0) { if (OPTIONAL_VARIABLES.includes(varName)) { - actionsCore.debug( + actionsCore2.debug( `Optional environment variable not set: ${varName} -- substituting with the variable name` ); value = varName; } else { - actionsCore.debug( + actionsCore2.debug( `Environment variable not set: ${varName} -- can't generate the requested identity` ); return void 0; @@ -307,14 +307,14 @@ __export(platform_exports, { getArchOs: () => getArchOs, getNixPlatform: () => getNixPlatform }); -import * as actionsCore2 from "@actions/core"; +import * as actionsCore3 from "@actions/core"; function getArchOs() { const envArch = process.env.RUNNER_ARCH; const envOs = process.env.RUNNER_OS; if (envArch && envOs) { return `${envArch}-${envOs}`; } else { - actionsCore2.error( + actionsCore3.error( `Can't identify the platform: RUNNER_ARCH or RUNNER_OS undefined (${envArch}-${envOs})` ); throw new Error("RUNNER_ARCH and/or RUNNER_OS is not defined"); @@ -331,7 +331,7 @@ function getNixPlatform(archOs) { if (mappedTo) { return mappedTo; } else { - actionsCore2.error( + actionsCore3.error( `ArchOs (${archOs}) doesn't map to a supported Nix platform.` ); throw new Error( @@ -350,12 +350,12 @@ __export(inputs_exports, { getStringOrNull: () => getStringOrNull, getStringOrUndefined: () => getStringOrUndefined }); -import * as actionsCore3 from "@actions/core"; +import * as actionsCore4 from "@actions/core"; var getBool = (name) => { - return actionsCore3.getBooleanInput(name); + return actionsCore4.getBooleanInput(name); }; var getMultilineStringOrNull = (name) => { - const value = actionsCore3.getMultilineInput(name); + const value = actionsCore4.getMultilineInput(name); if (value.length === 0) { return null; } else { @@ -363,7 +363,7 @@ var getMultilineStringOrNull = (name) => { } }; var getNumberOrNull = (name) => { - const value = actionsCore3.getInput(name); + const value = actionsCore4.getInput(name); if (value === "") { return null; } else { @@ -371,10 +371,10 @@ var getNumberOrNull = (name) => { } }; var getString = (name) => { - return actionsCore3.getInput(name); + return actionsCore4.getInput(name); }; var getStringOrNull = (name) => { - const value = actionsCore3.getInput(name); + const value = actionsCore4.getInput(name); if (value === "") { return null; } else { @@ -382,7 +382,7 @@ var getStringOrNull = (name) => { } }; var getStringOrUndefined = (name) => { - const value = actionsCore3.getInput(name); + const value = actionsCore4.getInput(name); if (value === "") { return void 0; } else { @@ -391,7 +391,7 @@ var getStringOrUndefined = (name) => { }; // src/sourcedef.ts -import * as actionsCore4 from "@actions/core"; +import * as actionsCore5 from "@actions/core"; function constructSourceParameters(legacyPrefix) { const noisilyGetInput = (suffix) => { const preferredInput = getStringOrUndefined(`source-${suffix}`); @@ -400,12 +400,12 @@ function constructSourceParameters(legacyPrefix) { } const legacyInput = getStringOrUndefined(`${legacyPrefix}-${suffix}`); if (preferredInput && legacyInput) { - actionsCore4.warning( + actionsCore5.warning( `The supported option source-${suffix} and the legacy option ${legacyPrefix}-${suffix} are both set. Preferring source-${suffix}. Please stop setting ${legacyPrefix}-${suffix}.` ); return preferredInput; } else if (legacyInput) { - actionsCore4.warning( + actionsCore5.warning( `The legacy option ${legacyPrefix}-${suffix} is set. Please migrate to source-${suffix}.` ); return legacyInput; @@ -425,7 +425,7 @@ function constructSourceParameters(legacyPrefix) { // src/index.ts import * as actionsCache from "@actions/cache"; -import * as actionsCore5 from "@actions/core"; +import * as actionsCore6 from "@actions/core"; import got from "got"; import { randomUUID } from "node:crypto"; import { createWriteStream } from "node:fs"; @@ -454,7 +454,7 @@ var IdsToolbox = class { hooks: { beforeRetry: [ (error2, retryCount) => { - actionsCore5.info( + actionsCore6.info( `Retrying after error ${error2.code}, retry #: ${retryCount}` ); } @@ -494,13 +494,13 @@ var IdsToolbox = class { this.addFact("$os_version", details.version); } }).catch((e) => { - actionsCore5.debug(`Failure getting platform details: ${e}`); + actionsCore6.debug(`Failure getting platform details: ${e}`); }); } { - const phase = actionsCore5.getState("idstoolbox_execution_phase"); + const phase = actionsCore6.getState("idstoolbox_execution_phase"); if (phase === "") { - actionsCore5.saveState("idstoolbox_execution_phase", "post"); + actionsCore6.saveState("idstoolbox_execution_phase", "post"); this.executionPhase = "main"; } else { this.executionPhase = "post"; @@ -555,9 +555,9 @@ var IdsToolbox = class { const reportable = error2 instanceof Error || typeof error2 == "string" ? error2.toString() : JSON.stringify(error2); this.addFact(FACT_FINAL_EXCEPTION, reportable); if (this.executionPhase === "post") { - actionsCore5.warning(reportable); + actionsCore6.warning(reportable); } else { - actionsCore5.setFailed(reportable); + actionsCore6.setFailed(reportable); } this.recordEvent(EVENT_EXCEPTION); } finally { @@ -587,46 +587,55 @@ var IdsToolbox = class { }); } async fetch() { - actionsCore5.info(`Fetching from ${this.getUrl()}`); - const correlatedUrl = this.getUrl(); - correlatedUrl.searchParams.set("ci", "github"); - correlatedUrl.searchParams.set( - "correlation", - JSON.stringify(this.identity) + actionsCore6.startGroup( + `Downloading ${this.actionOptions.name} for ${this.architectureFetchSuffix}` ); - const versionCheckup = await this.client.head(correlatedUrl); - if (versionCheckup.headers.etag) { - const v = versionCheckup.headers.etag; - actionsCore5.debug(`Checking the tool cache for ${this.getUrl()} at ${v}`); - const cached = await this.getCachedVersion(v); - if (cached) { - this.facts["artifact_fetched_from_cache"] = true; - actionsCore5.debug(`Tool cache hit.`); - return cached; + try { + actionsCore6.info(`Fetching from ${this.getUrl()}`); + const correlatedUrl = this.getUrl(); + correlatedUrl.searchParams.set("ci", "github"); + correlatedUrl.searchParams.set( + "correlation", + JSON.stringify(this.identity) + ); + const versionCheckup = await this.client.head(correlatedUrl); + if (versionCheckup.headers.etag) { + const v = versionCheckup.headers.etag; + actionsCore6.debug( + `Checking the tool cache for ${this.getUrl()} at ${v}` + ); + const cached = await this.getCachedVersion(v); + if (cached) { + this.facts["artifact_fetched_from_cache"] = true; + actionsCore6.debug(`Tool cache hit.`); + return cached; + } } - } - this.facts["artifact_fetched_from_cache"] = false; - actionsCore5.debug( - `No match from the cache, re-fetching from the redirect: ${versionCheckup.url}` - ); - const destFile = this.getTemporaryName(); - const fetchStream = this.client.stream(versionCheckup.url); - await pipeline( - fetchStream, - createWriteStream(destFile, { - encoding: "binary", - mode: 493 - }) - ); - if (fetchStream.response?.headers.etag) { - const v = fetchStream.response.headers.etag; - try { - await this.saveCachedVersion(v, destFile); - } catch (e) { - actionsCore5.debug(`Error caching the artifact: ${e}`); + this.facts["artifact_fetched_from_cache"] = false; + actionsCore6.debug( + `No match from the cache, re-fetching from the redirect: ${versionCheckup.url}` + ); + const destFile = this.getTemporaryName(); + const fetchStream = this.client.stream(versionCheckup.url); + await pipeline( + fetchStream, + createWriteStream(destFile, { + encoding: "binary", + mode: 493 + }) + ); + if (fetchStream.response?.headers.etag) { + const v = fetchStream.response.headers.etag; + try { + await this.saveCachedVersion(v, destFile); + } catch (e) { + actionsCore6.debug(`Error caching the artifact: ${e}`); + } } + return destFile; + } finally { + actionsCore6.endGroup(); } - return destFile; } async fetchExecutable() { const binaryPath = await this.fetch(); @@ -717,17 +726,17 @@ var IdsToolbox = class { const candidateNix = path.join(location, "nix"); try { await fs2.access(candidateNix, fs2.constants.X_OK); - actionsCore5.debug(`Found Nix at ${candidateNix}`); + actionsCore6.debug(`Found Nix at ${candidateNix}`); nixLocation = candidateNix; } catch { - actionsCore5.debug(`Nix not at ${candidateNix}`); + actionsCore6.debug(`Nix not at ${candidateNix}`); } } this.addFact("nix_location", nixLocation || ""); if (this.actionOptions.requireNix === "ignore") { return true; } - const currentNotFoundState = actionsCore5.getState( + const currentNotFoundState = actionsCore6.getState( "idstoolbox_nix_not_found" ); if (currentNotFoundState === "not-found") { @@ -736,15 +745,15 @@ var IdsToolbox = class { if (nixLocation !== void 0) { return true; } - actionsCore5.saveState("idstoolbox_nix_not_found", "not-found"); + actionsCore6.saveState("idstoolbox_nix_not_found", "not-found"); switch (this.actionOptions.requireNix) { case "fail": - actionsCore5.setFailed( + actionsCore6.setFailed( "This action can only be used when Nix is installed. Add `- uses: DeterminateSystems/nix-installer-action@main` earlier in your workflow." ); break; case "warn": - actionsCore5.warning( + actionsCore6.warning( "This action is in no-op mode because Nix is not installed. Add `- uses: DeterminateSystems/nix-installer-action@main` earlier in your workflow." ); break; @@ -753,10 +762,10 @@ var IdsToolbox = class { } async submitEvents() { if (!this.actionOptions.diagnosticsUrl) { - actionsCore5.debug( + actionsCore6.debug( "Diagnostics are disabled. Not sending the following events:" ); - actionsCore5.debug(JSON.stringify(this.events, void 0, 2)); + actionsCore6.debug(JSON.stringify(this.events, void 0, 2)); return; } const batch = { @@ -769,7 +778,7 @@ var IdsToolbox = class { json: batch }); } catch (error2) { - actionsCore5.debug(`Error submitting diagnostics event: ${error2}`); + actionsCore6.debug(`Error submitting diagnostics event: ${error2}`); } this.events = []; } @@ -792,8 +801,8 @@ function makeOptionsConfident(actionOptions) { actionOptions.diagnosticsUrl ) }; - actionsCore5.debug("idslib options:"); - actionsCore5.debug(JSON.stringify(finalOpts, void 0, 2)); + actionsCore6.debug("idslib options:"); + actionsCore6.debug(JSON.stringify(finalOpts, void 0, 2)); return finalOpts; } function determineDiagnosticsUrl(idsProjectName, urlOption) { @@ -812,7 +821,7 @@ function determineDiagnosticsUrl(idsProjectName, urlOption) { try { return mungeDiagnosticEndpoint(new URL(providedDiagnosticEndpoint)); } catch (e) { - actionsCore5.info( + actionsCore6.info( `User-provided diagnostic endpoint ignored: not a valid URL: ${e}` ); } @@ -824,7 +833,7 @@ function determineDiagnosticsUrl(idsProjectName, urlOption) { diagnosticUrl.pathname += "/diagnostics"; return diagnosticUrl; } catch (e) { - actionsCore5.info( + actionsCore6.info( `Generated diagnostic endpoint ignored: not a valid URL: ${e}` ); } @@ -846,7 +855,7 @@ function mungeDiagnosticEndpoint(inputUrl) { inputUrl.password = currentIdsHost.password; return inputUrl; } catch (e) { - actionsCore5.info(`Default or overridden IDS host isn't a valid URL: ${e}`); + actionsCore6.info(`Default or overridden IDS host isn't a valid URL: ${e}`); } return inputUrl; } diff --git a/dist/index.js.map b/dist/index.js.map index bd1c2c2..878d0fc 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../package.json","../src/linux-release-info.ts","../src/actions-core-platform.ts","../src/correlation.ts","../src/platform.ts","../src/inputs.ts","../src/sourcedef.ts","../src/index.ts"],"sourcesContent":["{\n \"name\": \"detsys-ts\",\n \"version\": \"1.0.0\",\n \"description\": \"TypeScript goodies for DetSys projects\",\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"type\": \"module\",\n \"scripts\": {\n \"build\": \"tsup\",\n \"check-fmt\": \"prettier --check .\",\n \"format\": \"prettier --write .\",\n \"lint\": \"eslint src/**/*.ts\",\n \"docs\": \"typedoc src/index.ts\",\n \"all\": \"rm -rf dist && pnpm run format && pnpm run lint && pnpm run build\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/DeterminateSystems/detsys-ts.git\"\n },\n \"keywords\": [],\n \"author\": \"\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/DeterminateSystems/detsys-ts/issues\"\n },\n \"homepage\": \"https://github.com/DeterminateSystems/detsys-ts#readme\",\n \"dependencies\": {\n \"@actions/cache\": \"^3.2.4\",\n \"@actions/core\": \"^1.10.1\",\n \"@actions/exec\": \"^1.1.1\",\n \"got\": \"^14.2.1\"\n },\n \"devDependencies\": {\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\n \"@types/node\": \"^20.12.7\",\n \"@typescript-eslint/eslint-plugin\": \"^7.6.0\",\n \"eslint\": \"^8.57.0\",\n \"eslint-import-resolver-typescript\": \"^3.6.1\",\n \"eslint-plugin-github\": \"^4.10.2\",\n \"eslint-plugin-import\": \"^2.29.1\",\n \"eslint-plugin-prettier\": \"^5.1.3\",\n \"prettier\": \"^3.2.5\",\n \"tsup\": \"^8.0.2\",\n \"typedoc\": \"^0.25.13\",\n \"typescript\": \"^5.4.5\"\n }\n}\n","/*!\n * linux-release-info\n * Get Linux release info (distribution name, version, arch, release, etc.)\n * from '/etc/os-release' or '/usr/lib/os-release' files and from native os\n * module. On Windows and Darwin platforms it only returns common node os module\n * info (platform, hostname, release, and arch)\n *\n * Licensed under MIT\n * Copyright (c) 2018-2020 [Samuel Carreira]\n */\n// NOTE: we depend on this directly to get around some un-fun issues with mixing CommonJS\n// and ESM in the bundle. We've modified the original logic to improve things like typing\n// and fixing ESLint issues. Originally drawn from:\n// https://github.com/samuelcarreira/linux-release-info/blob/84a91aa5442b47900da03020c590507545d3dc74/src/index.ts\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport { promisify } from \"node:util\";\n\nconst readFileAsync = promisify(fs.readFile);\n\nexport interface LinuxReleaseInfoOptions {\n /**\n * read mode, possible values: 'async' and 'sync'\n *\n * @default 'async'\n */\n mode?: \"async\" | \"sync\";\n /**\n * custom complete file path with os info default null/none\n * if not provided the system will search on the '/etc/os-release'\n * and '/usr/lib/os-release' files\n *\n * @default null\n */\n customFile?: string | null | undefined;\n /**\n * if true, show console debug messages\n *\n * @default false\n */\n debug?: boolean;\n}\n\nconst linuxReleaseInfoOptionsDefaults: LinuxReleaseInfoOptions = {\n mode: \"async\",\n customFile: null,\n debug: false,\n};\n\n/**\n * Get OS release info from 'os-release' file and from native os module\n * on Windows or Darwin it only returns common os module info\n * (uses native fs module)\n * @returns {object} info from the current os\n */\nexport function releaseInfo(infoOptions: LinuxReleaseInfoOptions): object {\n const options = { ...linuxReleaseInfoOptionsDefaults, ...infoOptions };\n\n const searchOsReleaseFileList: string[] = osReleaseFileList(\n options.customFile,\n );\n\n if (os.type() !== \"Linux\") {\n if (options.mode === \"sync\") {\n return getOsInfo();\n } else {\n return Promise.resolve(getOsInfo());\n }\n }\n\n if (options.mode === \"sync\") {\n return readSyncOsreleaseFile(searchOsReleaseFileList, options);\n } else {\n return Promise.resolve(\n readAsyncOsReleaseFile(searchOsReleaseFileList, options),\n );\n }\n}\n\n/**\n * Format file data: convert data to object keys/values\n *\n * @param {object} sourceData Source object to be appended\n * @param {string} srcParseData Input file data to be parsed\n * @returns {object} Formated object\n */\nfunction formatFileData(sourceData: OsInfo, srcParseData: string): OsInfo {\n const lines: string[] = srcParseData.split(\"\\n\");\n\n for (const line of lines) {\n const lineData = line.split(\"=\");\n\n if (lineData.length === 2) {\n lineData[1] = lineData[1].replace(/[\"'\\r]/gi, \"\"); // remove quotes and return character\n\n Object.defineProperty(sourceData, lineData[0].toLowerCase(), {\n value: lineData[1],\n writable: true,\n enumerable: true,\n configurable: true,\n });\n }\n }\n\n return sourceData;\n}\n\n/**\n * Export a list of os-release files\n *\n * @param {string} customFile optional custom complete filepath\n * @returns {array} list of os-release files\n */\nfunction osReleaseFileList(customFile: string | null | undefined): string[] {\n const DEFAULT_OS_RELEASE_FILES = [\"/etc/os-release\", \"/usr/lib/os-release\"];\n\n if (!customFile) {\n return DEFAULT_OS_RELEASE_FILES;\n } else {\n return Array(customFile);\n }\n}\n\n/**\n * Operating system info.\n */\ntype OsInfo = {\n type: string;\n platform: string;\n hostname: string;\n arch: string;\n release: string;\n};\n\n/**\n * Get OS Basic Info\n * (uses node 'os' native module)\n *\n * @returns {OsInfo} os basic info\n */\nfunction getOsInfo(): OsInfo {\n return {\n type: os.type(),\n platform: os.platform(),\n hostname: os.hostname(),\n arch: os.arch(),\n release: os.release(),\n };\n}\n\n/* Helper functions */\n\nasync function readAsyncOsReleaseFile(\n fileList: string[],\n options: LinuxReleaseInfoOptions,\n): Promise {\n let fileData = null;\n\n for (const osReleaseFile of fileList) {\n try {\n if (options.debug) {\n /* eslint-disable no-console */\n console.log(`Trying to read '${osReleaseFile}'...`);\n }\n\n fileData = await readFileAsync(osReleaseFile, \"binary\");\n\n if (options.debug) {\n console.log(`Read data:\\n${fileData}`);\n }\n\n break;\n } catch (error) {\n if (options.debug) {\n console.error(error);\n }\n }\n }\n\n if (fileData === null) {\n throw new Error(\"Cannot read os-release file!\");\n //return getOsInfo();\n }\n\n return formatFileData(getOsInfo(), fileData);\n}\n\nfunction readSyncOsreleaseFile(\n releaseFileList: string[],\n options: LinuxReleaseInfoOptions,\n): OsInfo {\n let fileData = null;\n\n for (const osReleaseFile of releaseFileList) {\n try {\n if (options.debug) {\n console.log(`Trying to read '${osReleaseFile}'...`);\n }\n\n fileData = fs.readFileSync(osReleaseFile, \"binary\");\n\n if (options.debug) {\n console.log(`Read data:\\n${fileData}`);\n }\n\n break;\n } catch (error) {\n if (options.debug) {\n console.error(error);\n }\n }\n }\n\n if (fileData === null) {\n throw new Error(\"Cannot read os-release file!\");\n //return getOsInfo();\n }\n\n return formatFileData(getOsInfo(), fileData);\n}\n","// MIT, mostly lifted from https://github.com/actions/toolkit/blob/5a736647a123ecf8582376bdaee833fbae5b3847/packages/core/src/platform.ts\n// since it isn't in @actions/core 1.10.1 which is their current release as 2024-04-19.\n// Changes: Replaced the lsb_release call in Linux with `linux-release-info` to parse the os-release file directly.\nimport { releaseInfo } from \"./linux-release-info.js\";\nimport * as core from \"@actions/core\";\nimport * as exec from \"@actions/exec\";\nimport os from \"os\";\n\n/**\n * The name and version of the Action runner's system.\n */\ntype SystemInfo = {\n name: string;\n version: string;\n};\n\n/**\n * Get the name and version of the current Windows system.\n */\nconst getWindowsInfo = async (): Promise => {\n const { stdout: version } = await exec.getExecOutput(\n 'powershell -command \"(Get-CimInstance -ClassName Win32_OperatingSystem).Version\"',\n undefined,\n {\n silent: true,\n },\n );\n\n const { stdout: name } = await exec.getExecOutput(\n 'powershell -command \"(Get-CimInstance -ClassName Win32_OperatingSystem).Caption\"',\n undefined,\n {\n silent: true,\n },\n );\n\n return {\n name: name.trim(),\n version: version.trim(),\n };\n};\n\n/**\n * Get the name and version of the current macOS system.\n */\nconst getMacOsInfo = async (): Promise => {\n const { stdout } = await exec.getExecOutput(\"sw_vers\", undefined, {\n silent: true,\n });\n\n const version = stdout.match(/ProductVersion:\\s*(.+)/)?.[1] ?? \"\";\n const name = stdout.match(/ProductName:\\s*(.+)/)?.[1] ?? \"\";\n\n return {\n name,\n version,\n };\n};\n\n/**\n * Get the name and version of the current Linux system.\n */\nconst getLinuxInfo = async (): Promise => {\n let data: object = {};\n\n try {\n data = releaseInfo({ mode: \"sync\" });\n // eslint-disable-next-line no-console\n console.log(data);\n } catch (e) {\n core.debug(`Error collecting release info: ${e}`);\n }\n\n return {\n name: getPropertyViaWithDefault(\n data,\n [\"id\", \"name\", \"pretty_name\", \"id_like\"],\n \"unknown\",\n ),\n version: getPropertyViaWithDefault(\n data,\n [\"version_id\", \"version\", \"version_codename\"],\n \"unknown\",\n ),\n };\n};\n\nfunction getPropertyViaWithDefault(\n data: object,\n names: Property[],\n defaultValue: T,\n): T {\n for (const name of names) {\n const ret: T = getPropertyWithDefault(data, name, defaultValue);\n\n if (ret !== defaultValue) {\n return ret;\n }\n }\n\n return defaultValue;\n}\n\nfunction getPropertyWithDefault(\n data: object,\n name: Property,\n defaultValue: T,\n): T {\n if (!data.hasOwnProperty(name)) {\n return defaultValue;\n }\n\n const value = (data as { [K in Property]: T })[name];\n\n // NB. this check won't work for object instances\n if (typeof value !== typeof defaultValue) {\n return defaultValue;\n }\n\n return value;\n}\n\n/**\n * The Action runner's platform.\n */\nexport const platform = os.platform();\n\n/**\n * The Action runner's architecture.\n */\nexport const arch = os.arch();\n\n/**\n * Whether the Action runner is a Windows system.\n */\nexport const isWindows = platform === \"win32\";\n\n/**\n * Whether the Action runner is a macOS system.\n */\nexport const isMacOS = platform === \"darwin\";\n\n/**\n * Whether the Action runner is a Linux system.\n */\nexport const isLinux = platform === \"linux\";\n\n/**\n * System-level information about the current host (platform, architecture, etc.).\n */\ntype SystemDetails = {\n name: string;\n platform: string;\n arch: string;\n version: string;\n isWindows: boolean;\n isMacOS: boolean;\n isLinux: boolean;\n};\n\n/**\n * Get system-level information about the current host (platform, architecture, etc.).\n */\nexport async function getDetails(): Promise {\n return {\n ...(await (isWindows\n ? getWindowsInfo()\n : isMacOS\n ? getMacOsInfo()\n : getLinuxInfo())),\n platform,\n arch,\n isWindows,\n isMacOS,\n isLinux,\n };\n}\n","import * as actionsCore from \"@actions/core\";\nimport { createHash } from \"node:crypto\";\n\nconst OPTIONAL_VARIABLES = [\"INVOCATION_ID\"];\n\n// JSON sent to server\n/* eslint-disable camelcase */\nexport type AnonymizedCorrelationHashes = {\n correlation_source: string;\n repository?: string;\n run?: string;\n run_differentiator?: string;\n workflow?: string;\n groups: Record;\n};\n\nexport function identify(projectName: string): AnonymizedCorrelationHashes {\n const ident = {\n correlation_source: \"github-actions\",\n\n repository: hashEnvironmentVariables(\"GHR\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n \"GITHUB_REPOSITORY\",\n \"GITHUB_REPOSITORY_ID\",\n ]),\n workflow: hashEnvironmentVariables(\"GHW\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n \"GITHUB_REPOSITORY\",\n \"GITHUB_REPOSITORY_ID\",\n \"GITHUB_WORKFLOW\",\n ]),\n job: hashEnvironmentVariables(\"GHWJ\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n \"GITHUB_REPOSITORY\",\n \"GITHUB_REPOSITORY_ID\",\n \"GITHUB_WORKFLOW\",\n \"GITHUB_JOB\",\n ]),\n run: hashEnvironmentVariables(\"GHWJR\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n \"GITHUB_REPOSITORY\",\n \"GITHUB_REPOSITORY_ID\",\n \"GITHUB_WORKFLOW\",\n \"GITHUB_JOB\",\n \"GITHUB_RUN_ID\",\n ]),\n run_differentiator: hashEnvironmentVariables(\"GHWJA\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n \"GITHUB_REPOSITORY\",\n \"GITHUB_REPOSITORY_ID\",\n \"GITHUB_WORKFLOW\",\n \"GITHUB_JOB\",\n \"GITHUB_RUN_ID\",\n \"GITHUB_RUN_NUMBER\",\n \"GITHUB_RUN_ATTEMPT\",\n \"INVOCATION_ID\",\n ]),\n groups: {\n ci: \"github-actions\",\n project: projectName,\n github_organization: hashEnvironmentVariables(\"GHO\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n ]),\n },\n };\n\n actionsCore.debug(\"Correlation data:\");\n actionsCore.debug(JSON.stringify(ident, null, 2));\n\n return ident;\n}\n\nfunction hashEnvironmentVariables(\n prefix: string,\n variables: string[],\n): undefined | string {\n const hash = createHash(\"sha256\");\n\n for (const varName of variables) {\n let value = process.env[varName];\n\n if (value === undefined) {\n if (OPTIONAL_VARIABLES.includes(varName)) {\n actionsCore.debug(\n `Optional environment variable not set: ${varName} -- substituting with the variable name`,\n );\n value = varName;\n } else {\n actionsCore.debug(\n `Environment variable not set: ${varName} -- can't generate the requested identity`,\n );\n return undefined;\n }\n }\n\n hash.update(value);\n hash.update(\"\\0\");\n }\n\n return `${prefix}-${hash.digest(\"hex\")}`;\n}\n","/**\n * @packageDocumentation\n * Helpers for determining system attributes of the current runner.\n */\nimport * as actionsCore from \"@actions/core\";\n\n/**\n * Get the current architecture plus OS. Examples include `X64-Linux` and `ARM64-macOS`.\n */\nexport function getArchOs(): string {\n const envArch = process.env.RUNNER_ARCH;\n const envOs = process.env.RUNNER_OS;\n\n if (envArch && envOs) {\n return `${envArch}-${envOs}`;\n } else {\n actionsCore.error(\n `Can't identify the platform: RUNNER_ARCH or RUNNER_OS undefined (${envArch}-${envOs})`,\n );\n throw new Error(\"RUNNER_ARCH and/or RUNNER_OS is not defined\");\n }\n}\n\n/**\n * Get the current Nix system. Examples include `x86_64-linux` and `aarch64-darwin`.\n */\nexport function getNixPlatform(archOs: string): string {\n const archOsMap: Map = new Map([\n [\"X64-macOS\", \"x86_64-darwin\"],\n [\"ARM64-macOS\", \"aarch64-darwin\"],\n [\"X64-Linux\", \"x86_64-linux\"],\n [\"ARM64-Linux\", \"aarch64-linux\"],\n ]);\n\n const mappedTo = archOsMap.get(archOs);\n if (mappedTo) {\n return mappedTo;\n } else {\n actionsCore.error(\n `ArchOs (${archOs}) doesn't map to a supported Nix platform.`,\n );\n throw new Error(\n `Cannot convert ArchOs (${archOs}) to a supported Nix platform.`,\n );\n }\n}\n","/**\n * @packageDocumentation\n * Helpers for getting values from an Action's configuration.\n */\nimport * as actionsCore from \"@actions/core\";\n\n/**\n * Get a Boolean input from the Action's configuration by name.\n */\nconst getBool = (name: string): boolean => {\n return actionsCore.getBooleanInput(name);\n};\n\n/**\n * Get a multi-line string input from the Action's configuration by name or return `null` if not set.\n */\nconst getMultilineStringOrNull = (name: string): string[] | null => {\n const value = actionsCore.getMultilineInput(name);\n if (value.length === 0) {\n return null;\n } else {\n return value;\n }\n};\n\n/**\n * Get a number input from the Action's configuration by name or return `null` if not set.\n */\nconst getNumberOrNull = (name: string): number | null => {\n const value = actionsCore.getInput(name);\n if (value === \"\") {\n return null;\n } else {\n return Number(value);\n }\n};\n\n/**\n * Get a string input from the Action's configuration.\n */\nconst getString = (name: string): string => {\n return actionsCore.getInput(name);\n};\n\n/**\n * Get a string input from the Action's configuration by name or return `null` if not set.\n */\nconst getStringOrNull = (name: string): string | null => {\n const value = actionsCore.getInput(name);\n if (value === \"\") {\n return null;\n } else {\n return value;\n }\n};\n\n/**\n * Get a string input from the Action's configuration by name or return `undefined` if not set.\n */\nconst getStringOrUndefined = (name: string): string | undefined => {\n const value = actionsCore.getInput(name);\n if (value === \"\") {\n return undefined;\n } else {\n return value;\n }\n};\n\nexport {\n getBool,\n getMultilineStringOrNull,\n getNumberOrNull,\n getString,\n getStringOrNull,\n getStringOrUndefined,\n};\n","import { getStringOrUndefined } from \"./inputs.js\";\nimport * as actionsCore from \"@actions/core\";\n\nexport type SourceDef = {\n path?: string;\n url?: string;\n tag?: string;\n pr?: string;\n branch?: string;\n revision?: string;\n};\n\nexport function constructSourceParameters(legacyPrefix?: string): SourceDef {\n const noisilyGetInput = (suffix: string): string | undefined => {\n const preferredInput = getStringOrUndefined(`source-${suffix}`);\n\n if (!legacyPrefix) {\n return preferredInput;\n }\n\n // Remaining is for handling cases where the legacy prefix\n // should be examined.\n const legacyInput = getStringOrUndefined(`${legacyPrefix}-${suffix}`);\n\n if (preferredInput && legacyInput) {\n actionsCore.warning(\n `The supported option source-${suffix} and the legacy option ${legacyPrefix}-${suffix} are both set. Preferring source-${suffix}. Please stop setting ${legacyPrefix}-${suffix}.`,\n );\n return preferredInput;\n } else if (legacyInput) {\n actionsCore.warning(\n `The legacy option ${legacyPrefix}-${suffix} is set. Please migrate to source-${suffix}.`,\n );\n return legacyInput;\n } else {\n return preferredInput;\n }\n };\n\n return {\n path: noisilyGetInput(\"path\"),\n url: noisilyGetInput(\"url\"),\n tag: noisilyGetInput(\"tag\"),\n pr: noisilyGetInput(\"pr\"),\n branch: noisilyGetInput(\"branch\"),\n revision: noisilyGetInput(\"revision\"),\n };\n}\n","/**\n * @packageDocumentation\n * Determinate Systems' TypeScript library for creating GitHub Actions logic.\n */\nimport { version as pkgVersion } from \"../package.json\";\nimport * as ghActionsCorePlatform from \"./actions-core-platform.js\";\nimport * as correlation from \"./correlation.js\";\nimport * as platform from \"./platform.js\";\nimport { SourceDef, constructSourceParameters } from \"./sourcedef.js\";\nimport * as actionsCache from \"@actions/cache\";\nimport * as actionsCore from \"@actions/core\";\nimport got, { Got } from \"got\";\nimport { UUID, randomUUID } from \"node:crypto\";\nimport { createWriteStream } from \"node:fs\";\nimport fs, { chmod, copyFile, mkdir } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport * as path from \"node:path\";\nimport { pipeline } from \"node:stream/promises\";\n\nconst DEFAULT_IDS_HOST = \"https://install.determinate.systems\";\nconst IDS_HOST = process.env[\"IDS_HOST\"] ?? DEFAULT_IDS_HOST;\n\nconst EVENT_EXCEPTION = \"exception\";\nconst EVENT_ARTIFACT_CACHE_HIT = \"artifact_cache_hit\";\nconst EVENT_ARTIFACT_CACHE_MISS = \"artifact_cache_miss\";\n\nconst FACT_ENDED_WITH_EXCEPTION = \"ended_with_exception\";\nconst FACT_FINAL_EXCEPTION = \"final_exception\";\n\nexport type FetchSuffixStyle = \"nix-style\" | \"gh-env-style\" | \"universal\";\nexport type ExecutionPhase = \"main\" | \"post\";\nexport type NixRequirementHandling = \"fail\" | \"warn\" | \"ignore\";\n\nexport type ActionOptions = {\n // Name of the project generally, and the name of the binary on disk.\n name: string;\n\n // Defaults to `name`, Corresponds to the ProjectHost entry on i.d.s.\n idsProjectName?: string;\n\n // Defaults to `action:`\n eventPrefix?: string;\n\n // The \"architecture\" URL component expected by I.D.S. for the ProjectHost.\n fetchStyle: FetchSuffixStyle;\n\n // IdsToolbox assumes the GitHub Action exposes source overrides, like branch/pr/etc. to be named `source-*`.\n // This prefix adds a fallback name, prefixed by `${legacySourcePrefix}-`.\n // Users who configure legacySourcePrefix will get warnings asking them to change to `source-*`.\n legacySourcePrefix?: string;\n\n // Check if Nix is installed before running this action.\n // If Nix isn't installed, this action will not fail, and will instead do nothing.\n // The action will emit a user-visible warning instructing them to install Nix.\n requireNix: NixRequirementHandling;\n\n // The URL to send diagnostics events to.\n // Specifically:\n // * `undefined` -> Attempt to read the `diagnostic-enpdoint` action input, and calculate the default diagnostics URL for IDS from there.\n // * `null` -> Disable sending diagnostics altogether.\n // * URL(...) -> Send diagnostics to this other URL instead\n diagnosticsUrl?: URL | null;\n};\n\n// A confident version of Options, where defaults have been resolved into final values\ntype ConfidentActionOptions = {\n name: string;\n idsProjectName: string;\n eventPrefix: string;\n fetchStyle: FetchSuffixStyle;\n legacySourcePrefix?: string;\n requireNix: NixRequirementHandling;\n diagnosticsUrl?: URL;\n};\n\ntype DiagnosticEvent = {\n event_name: string;\n correlation: correlation.AnonymizedCorrelationHashes;\n facts: Record;\n context: Record;\n timestamp: Date;\n uuid: UUID;\n};\n\nexport class IdsToolbox {\n private identity: correlation.AnonymizedCorrelationHashes;\n private actionOptions: ConfidentActionOptions;\n private archOs: string;\n private nixSystem: string;\n private architectureFetchSuffix: string;\n private executionPhase: ExecutionPhase;\n private sourceParameters: SourceDef;\n private facts: Record;\n private events: DiagnosticEvent[];\n private client: Got;\n\n private hookMain?: () => Promise;\n private hookPost?: () => Promise;\n\n constructor(actionOptions: ActionOptions) {\n this.actionOptions = makeOptionsConfident(actionOptions);\n this.hookMain = undefined;\n this.hookPost = undefined;\n\n this.events = [];\n this.client = got.extend({\n retry: {\n limit: 3,\n methods: [\"GET\", \"HEAD\"],\n },\n hooks: {\n beforeRetry: [\n (error, retryCount) => {\n actionsCore.info(\n `Retrying after error ${error.code}, retry #: ${retryCount}`,\n );\n },\n ],\n },\n });\n\n // JSON sent to server\n /* eslint-disable camelcase */\n this.facts = {\n $lib: \"idslib\",\n $lib_version: pkgVersion,\n project: this.actionOptions.name,\n ids_project: this.actionOptions.idsProjectName,\n };\n\n const params = [\n [\"github_action_ref\", \"GITHUB_ACTION_REF\"],\n [\"github_action_repository\", \"GITHUB_ACTION_REPOSITORY\"],\n [\"github_event_name\", \"GITHUB_EVENT_NAME\"],\n [\"$os\", \"RUNNER_OS\"],\n [\"arch\", \"RUNNER_ARCH\"],\n ];\n for (const [target, env] of params) {\n const value = process.env[env];\n if (value) {\n this.facts[target] = value;\n }\n }\n\n this.identity = correlation.identify(this.actionOptions.name);\n this.archOs = platform.getArchOs();\n this.nixSystem = platform.getNixPlatform(this.archOs);\n\n this.facts.arch_os = this.archOs;\n this.facts.nix_system = this.nixSystem;\n\n {\n ghActionsCorePlatform\n .getDetails()\n // eslint-disable-next-line github/no-then\n .then((details) => {\n if (details.name !== \"unknown\") {\n this.addFact(\"$os\", details.name);\n }\n if (details.version !== \"unknown\") {\n this.addFact(\"$os_version\", details.version);\n }\n })\n // eslint-disable-next-line github/no-then\n .catch((e) => {\n actionsCore.debug(`Failure getting platform details: ${e}`);\n });\n }\n\n {\n const phase = actionsCore.getState(\"idstoolbox_execution_phase\");\n if (phase === \"\") {\n actionsCore.saveState(\"idstoolbox_execution_phase\", \"post\");\n this.executionPhase = \"main\";\n } else {\n this.executionPhase = \"post\";\n }\n this.facts.execution_phase = this.executionPhase;\n }\n\n if (this.actionOptions.fetchStyle === \"gh-env-style\") {\n this.architectureFetchSuffix = this.archOs;\n } else if (this.actionOptions.fetchStyle === \"nix-style\") {\n this.architectureFetchSuffix = this.nixSystem;\n } else if (this.actionOptions.fetchStyle === \"universal\") {\n this.architectureFetchSuffix = \"universal\";\n } else {\n throw new Error(\n `fetchStyle ${this.actionOptions.fetchStyle} is not a valid style`,\n );\n }\n\n this.sourceParameters = constructSourceParameters(\n this.actionOptions.legacySourcePrefix,\n );\n\n this.recordEvent(`begin_${this.executionPhase}`);\n }\n\n onMain(callback: () => Promise): void {\n this.hookMain = callback;\n }\n\n onPost(callback: () => Promise): void {\n this.hookPost = callback;\n }\n\n execute(): void {\n // eslint-disable-next-line github/no-then\n this.executeAsync().catch((error: Error) => {\n // eslint-disable-next-line no-console\n console.log(error);\n process.exitCode = 1;\n });\n }\n\n private async executeAsync(): Promise {\n try {\n process.env.DETSYS_CORRELATION = JSON.stringify(\n this.getCorrelationHashes(),\n );\n\n if (!(await this.preflightRequireNix())) {\n this.recordEvent(\"preflight-require-nix-denied\");\n return;\n }\n\n if (this.executionPhase === \"main\" && this.hookMain) {\n await this.hookMain();\n } else if (this.executionPhase === \"post\" && this.hookPost) {\n await this.hookPost();\n }\n this.addFact(FACT_ENDED_WITH_EXCEPTION, false);\n } catch (error) {\n this.addFact(FACT_ENDED_WITH_EXCEPTION, true);\n\n const reportable =\n error instanceof Error || typeof error == \"string\"\n ? error.toString()\n : JSON.stringify(error);\n\n this.addFact(FACT_FINAL_EXCEPTION, reportable);\n\n if (this.executionPhase === \"post\") {\n actionsCore.warning(reportable);\n } else {\n actionsCore.setFailed(reportable);\n }\n\n this.recordEvent(EVENT_EXCEPTION);\n } finally {\n await this.complete();\n }\n }\n\n addFact(key: string, value: string | boolean): void {\n this.facts[key] = value;\n }\n\n getDiagnosticsUrl(): URL | undefined {\n return this.actionOptions.diagnosticsUrl;\n }\n\n getUniqueId(): string {\n return (\n this.identity.run_differentiator ||\n process.env.RUNNER_TRACKING_ID ||\n randomUUID()\n );\n }\n\n getCorrelationHashes(): correlation.AnonymizedCorrelationHashes {\n return this.identity;\n }\n\n recordEvent(eventName: string, context: Record = {}): void {\n this.events.push({\n event_name: `${this.actionOptions.eventPrefix}${eventName}`,\n context,\n correlation: this.identity,\n facts: this.facts,\n timestamp: new Date(),\n uuid: randomUUID(),\n });\n }\n\n async fetch(): Promise {\n actionsCore.info(`Fetching from ${this.getUrl()}`);\n\n const correlatedUrl = this.getUrl();\n correlatedUrl.searchParams.set(\"ci\", \"github\");\n correlatedUrl.searchParams.set(\n \"correlation\",\n JSON.stringify(this.identity),\n );\n\n const versionCheckup = await this.client.head(correlatedUrl);\n if (versionCheckup.headers.etag) {\n const v = versionCheckup.headers.etag;\n\n actionsCore.debug(`Checking the tool cache for ${this.getUrl()} at ${v}`);\n const cached = await this.getCachedVersion(v);\n if (cached) {\n this.facts[\"artifact_fetched_from_cache\"] = true;\n actionsCore.debug(`Tool cache hit.`);\n return cached;\n }\n }\n\n this.facts[\"artifact_fetched_from_cache\"] = false;\n\n actionsCore.debug(\n `No match from the cache, re-fetching from the redirect: ${versionCheckup.url}`,\n );\n\n const destFile = this.getTemporaryName();\n const fetchStream = this.client.stream(versionCheckup.url);\n\n await pipeline(\n fetchStream,\n createWriteStream(destFile, {\n encoding: \"binary\",\n mode: 0o755,\n }),\n );\n\n if (fetchStream.response?.headers.etag) {\n const v = fetchStream.response.headers.etag;\n\n try {\n await this.saveCachedVersion(v, destFile);\n } catch (e) {\n actionsCore.debug(`Error caching the artifact: ${e}`);\n }\n }\n\n return destFile;\n }\n\n async fetchExecutable(): Promise {\n const binaryPath = await this.fetch();\n await chmod(binaryPath, fs.constants.S_IXUSR | fs.constants.S_IXGRP);\n return binaryPath;\n }\n\n private async complete(): Promise {\n this.recordEvent(`complete_${this.executionPhase}`);\n await this.submitEvents();\n }\n\n private getUrl(): URL {\n const p = this.sourceParameters;\n\n if (p.url) {\n return new URL(p.url);\n }\n\n const fetchUrl = new URL(IDS_HOST);\n fetchUrl.pathname += this.actionOptions.idsProjectName;\n\n if (p.tag) {\n fetchUrl.pathname += `/tag/${p.tag}`;\n } else if (p.pr) {\n fetchUrl.pathname += `/pr/${p.pr}`;\n } else if (p.branch) {\n fetchUrl.pathname += `/branch/${p.branch}`;\n } else if (p.revision) {\n fetchUrl.pathname += `/rev/${p.revision}`;\n } else {\n fetchUrl.pathname += `/stable`;\n }\n\n fetchUrl.pathname += `/${this.architectureFetchSuffix}`;\n\n return fetchUrl;\n }\n\n private cacheKey(version: string): string {\n const cleanedVersion = version.replace(/[^a-zA-Z0-9-+.]/g, \"\");\n return `determinatesystem-${this.actionOptions.name}-${this.architectureFetchSuffix}-${cleanedVersion}`;\n }\n\n private async getCachedVersion(version: string): Promise {\n const startCwd = process.cwd();\n\n try {\n const tempDir = this.getTemporaryName();\n await mkdir(tempDir);\n process.chdir(tempDir);\n\n // extremely evil shit right here:\n process.env.GITHUB_WORKSPACE_BACKUP = process.env.GITHUB_WORKSPACE;\n delete process.env.GITHUB_WORKSPACE;\n\n if (\n await actionsCache.restoreCache(\n [this.actionOptions.name],\n this.cacheKey(version),\n [],\n undefined,\n true,\n )\n ) {\n this.recordEvent(EVENT_ARTIFACT_CACHE_HIT);\n return `${tempDir}/${this.actionOptions.name}`;\n }\n\n this.recordEvent(EVENT_ARTIFACT_CACHE_MISS);\n return undefined;\n } finally {\n process.env.GITHUB_WORKSPACE = process.env.GITHUB_WORKSPACE_BACKUP;\n delete process.env.GITHUB_WORKSPACE_BACKUP;\n process.chdir(startCwd);\n }\n }\n\n private async saveCachedVersion(\n version: string,\n toolPath: string,\n ): Promise {\n const startCwd = process.cwd();\n\n try {\n const tempDir = this.getTemporaryName();\n await mkdir(tempDir);\n process.chdir(tempDir);\n await copyFile(toolPath, `${tempDir}/${this.actionOptions.name}`);\n\n // extremely evil shit right here:\n process.env.GITHUB_WORKSPACE_BACKUP = process.env.GITHUB_WORKSPACE;\n delete process.env.GITHUB_WORKSPACE;\n\n await actionsCache.saveCache(\n [this.actionOptions.name],\n this.cacheKey(version),\n undefined,\n true,\n );\n this.recordEvent(EVENT_ARTIFACT_CACHE_HIT);\n } finally {\n process.env.GITHUB_WORKSPACE = process.env.GITHUB_WORKSPACE_BACKUP;\n delete process.env.GITHUB_WORKSPACE_BACKUP;\n process.chdir(startCwd);\n }\n }\n\n private async preflightRequireNix(): Promise {\n let nixLocation: string | undefined;\n\n const pathParts = (process.env[\"PATH\"] || \"\").split(\":\");\n for (const location of pathParts) {\n const candidateNix = path.join(location, \"nix\");\n\n try {\n await fs.access(candidateNix, fs.constants.X_OK);\n actionsCore.debug(`Found Nix at ${candidateNix}`);\n nixLocation = candidateNix;\n } catch {\n actionsCore.debug(`Nix not at ${candidateNix}`);\n }\n }\n this.addFact(\"nix_location\", nixLocation || \"\");\n\n if (this.actionOptions.requireNix === \"ignore\") {\n return true;\n }\n\n const currentNotFoundState = actionsCore.getState(\n \"idstoolbox_nix_not_found\",\n );\n if (currentNotFoundState === \"not-found\") {\n // It was previously not found, so don't run subsequent actions\n return false;\n }\n\n if (nixLocation !== undefined) {\n return true;\n }\n actionsCore.saveState(\"idstoolbox_nix_not_found\", \"not-found\");\n\n switch (this.actionOptions.requireNix) {\n case \"fail\":\n actionsCore.setFailed(\n \"This action can only be used when Nix is installed.\" +\n \" Add `- uses: DeterminateSystems/nix-installer-action@main` earlier in your workflow.\",\n );\n break;\n case \"warn\":\n actionsCore.warning(\n \"This action is in no-op mode because Nix is not installed.\" +\n \" Add `- uses: DeterminateSystems/nix-installer-action@main` earlier in your workflow.\",\n );\n break;\n }\n\n return false;\n }\n\n private async submitEvents(): Promise {\n if (!this.actionOptions.diagnosticsUrl) {\n actionsCore.debug(\n \"Diagnostics are disabled. Not sending the following events:\",\n );\n actionsCore.debug(JSON.stringify(this.events, undefined, 2));\n return;\n }\n\n const batch = {\n type: \"eventlog\",\n sent_at: new Date(),\n events: this.events,\n };\n\n try {\n await this.client.post(this.actionOptions.diagnosticsUrl, {\n json: batch,\n });\n } catch (error) {\n actionsCore.debug(`Error submitting diagnostics event: ${error}`);\n }\n this.events = [];\n }\n\n private getTemporaryName(): string {\n const _tmpdir = process.env[\"RUNNER_TEMP\"] || tmpdir();\n return path.join(_tmpdir, `${this.actionOptions.name}-${randomUUID()}`);\n }\n}\n\nfunction makeOptionsConfident(\n actionOptions: ActionOptions,\n): ConfidentActionOptions {\n const idsProjectName = actionOptions.idsProjectName ?? actionOptions.name;\n\n const finalOpts: ConfidentActionOptions = {\n name: actionOptions.name,\n idsProjectName,\n eventPrefix: actionOptions.eventPrefix || \"action:\",\n fetchStyle: actionOptions.fetchStyle,\n legacySourcePrefix: actionOptions.legacySourcePrefix,\n requireNix: actionOptions.requireNix,\n diagnosticsUrl: determineDiagnosticsUrl(\n idsProjectName,\n actionOptions.diagnosticsUrl,\n ),\n };\n\n actionsCore.debug(\"idslib options:\");\n actionsCore.debug(JSON.stringify(finalOpts, undefined, 2));\n\n return finalOpts;\n}\n\nfunction determineDiagnosticsUrl(\n idsProjectName: string,\n urlOption?: URL | null,\n): undefined | URL {\n if (urlOption === null) {\n // Disable diagnostict events\n return undefined;\n }\n\n if (urlOption !== undefined) {\n // Caller specified a specific diagnostics URL\n return urlOption;\n }\n\n {\n // Attempt to use the action input's diagnostic-endpoint option.\n\n // Note: we don't use actionsCore.getInput('diagnostic-endpoint') on purpose:\n // getInput silently converts absent data to an empty string.\n const providedDiagnosticEndpoint = process.env[\"INPUT_DIAGNOSTIC-ENDPOINT\"];\n if (providedDiagnosticEndpoint === \"\") {\n // User probably explicitly turned it off\n return undefined;\n }\n\n if (providedDiagnosticEndpoint !== undefined) {\n try {\n return mungeDiagnosticEndpoint(new URL(providedDiagnosticEndpoint));\n } catch (e) {\n actionsCore.info(\n `User-provided diagnostic endpoint ignored: not a valid URL: ${e}`,\n );\n }\n }\n }\n\n try {\n const diagnosticUrl = new URL(IDS_HOST);\n diagnosticUrl.pathname += idsProjectName;\n diagnosticUrl.pathname += \"/diagnostics\";\n return diagnosticUrl;\n } catch (e) {\n actionsCore.info(\n `Generated diagnostic endpoint ignored: not a valid URL: ${e}`,\n );\n }\n\n return undefined;\n}\n\nfunction mungeDiagnosticEndpoint(inputUrl: URL): URL {\n if (DEFAULT_IDS_HOST === IDS_HOST) {\n return inputUrl;\n }\n\n try {\n const defaultIdsHost = new URL(DEFAULT_IDS_HOST);\n const currentIdsHost = new URL(IDS_HOST);\n\n if (inputUrl.origin !== defaultIdsHost.origin) {\n return inputUrl;\n }\n\n inputUrl.protocol = currentIdsHost.protocol;\n inputUrl.host = currentIdsHost.host;\n inputUrl.username = currentIdsHost.username;\n inputUrl.password = currentIdsHost.password;\n\n return inputUrl;\n } catch (e) {\n actionsCore.info(`Default or overridden IDS host isn't a valid URL: ${e}`);\n }\n\n return inputUrl;\n}\n\n// Public exports from other files\nexport * as inputs from \"./inputs.js\";\nexport * as platform from \"./platform.js\";\n"],"mappings":";;;;;;;AAEE,cAAW;;;ACYb,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,SAAS,iBAAiB;AAE1B,IAAM,gBAAgB,UAAa,WAAQ;AAyB3C,IAAM,kCAA2D;AAAA,EAC/D,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,OAAO;AACT;AAQO,SAAS,YAAY,aAA8C;AACxE,QAAM,UAAU,EAAE,GAAG,iCAAiC,GAAG,YAAY;AAErE,QAAM,0BAAoC;AAAA,IACxC,QAAQ;AAAA,EACV;AAEA,MAAO,QAAK,MAAM,SAAS;AACzB,QAAI,QAAQ,SAAS,QAAQ;AAC3B,aAAO,UAAU;AAAA,IACnB,OAAO;AACL,aAAO,QAAQ,QAAQ,UAAU,CAAC;AAAA,IACpC;AAAA,EACF;AAEA,MAAI,QAAQ,SAAS,QAAQ;AAC3B,WAAO,sBAAsB,yBAAyB,OAAO;AAAA,EAC/D,OAAO;AACL,WAAO,QAAQ;AAAA,MACb,uBAAuB,yBAAyB,OAAO;AAAA,IACzD;AAAA,EACF;AACF;AASA,SAAS,eAAe,YAAoB,cAA8B;AACxE,QAAM,QAAkB,aAAa,MAAM,IAAI;AAE/C,aAAW,QAAQ,OAAO;AACxB,UAAM,WAAW,KAAK,MAAM,GAAG;AAE/B,QAAI,SAAS,WAAW,GAAG;AACzB,eAAS,CAAC,IAAI,SAAS,CAAC,EAAE,QAAQ,YAAY,EAAE;AAEhD,aAAO,eAAe,YAAY,SAAS,CAAC,EAAE,YAAY,GAAG;AAAA,QAC3D,OAAO,SAAS,CAAC;AAAA,QACjB,UAAU;AAAA,QACV,YAAY;AAAA,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","actionsCore","actionsCore","actionsCore","fs","error","version"]} \ No newline at end of file +{"version":3,"sources":["../package.json","../src/linux-release-info.ts","../src/actions-core-platform.ts","../src/correlation.ts","../src/platform.ts","../src/inputs.ts","../src/sourcedef.ts","../src/index.ts"],"sourcesContent":["{\n \"name\": \"detsys-ts\",\n \"version\": \"1.0.0\",\n \"description\": \"TypeScript goodies for DetSys projects\",\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"type\": \"module\",\n \"scripts\": {\n \"build\": \"tsup\",\n \"check-fmt\": \"prettier --check .\",\n \"format\": \"prettier --write .\",\n \"lint\": \"eslint src/**/*.ts\",\n \"docs\": \"typedoc src/index.ts\",\n \"all\": \"rm -rf dist && pnpm run format && pnpm run lint && pnpm run build\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/DeterminateSystems/detsys-ts.git\"\n },\n \"keywords\": [],\n \"author\": \"\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/DeterminateSystems/detsys-ts/issues\"\n },\n \"homepage\": \"https://github.com/DeterminateSystems/detsys-ts#readme\",\n \"dependencies\": {\n \"@actions/cache\": \"^3.2.4\",\n \"@actions/core\": \"^1.10.1\",\n \"@actions/exec\": \"^1.1.1\",\n \"got\": \"^14.2.1\"\n },\n \"devDependencies\": {\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\n \"@types/node\": \"^20.12.7\",\n \"@typescript-eslint/eslint-plugin\": \"^7.6.0\",\n \"eslint\": \"^8.57.0\",\n \"eslint-import-resolver-typescript\": \"^3.6.1\",\n \"eslint-plugin-github\": \"^4.10.2\",\n \"eslint-plugin-import\": \"^2.29.1\",\n \"eslint-plugin-prettier\": \"^5.1.3\",\n \"prettier\": \"^3.2.5\",\n \"tsup\": \"^8.0.2\",\n \"typedoc\": \"^0.25.13\",\n \"typescript\": \"^5.4.5\"\n }\n}\n","/*!\n * linux-release-info\n * Get Linux release info (distribution name, version, arch, release, etc.)\n * from '/etc/os-release' or '/usr/lib/os-release' files and from native os\n * module. On Windows and Darwin platforms it only returns common node os module\n * info (platform, hostname, release, and arch)\n *\n * Licensed under MIT\n * Copyright (c) 2018-2020 [Samuel Carreira]\n */\n// NOTE: we depend on this directly to get around some un-fun issues with mixing CommonJS\n// and ESM in the bundle. We've modified the original logic to improve things like typing\n// and fixing ESLint issues. Originally drawn from:\n// https://github.com/samuelcarreira/linux-release-info/blob/84a91aa5442b47900da03020c590507545d3dc74/src/index.ts\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport { promisify } from \"node:util\";\n\nconst readFileAsync = promisify(fs.readFile);\n\nexport interface LinuxReleaseInfoOptions {\n /**\n * read mode, possible values: 'async' and 'sync'\n *\n * @default 'async'\n */\n mode?: \"async\" | \"sync\";\n /**\n * custom complete file path with os info default null/none\n * if not provided the system will search on the '/etc/os-release'\n * and '/usr/lib/os-release' files\n *\n * @default null\n */\n customFile?: string | null | undefined;\n /**\n * if true, show console debug messages\n *\n * @default false\n */\n debug?: boolean;\n}\n\nconst linuxReleaseInfoOptionsDefaults: LinuxReleaseInfoOptions = {\n mode: \"async\",\n customFile: null,\n debug: false,\n};\n\n/**\n * Get OS release info from 'os-release' file and from native os module\n * on Windows or Darwin it only returns common os module info\n * (uses native fs module)\n * @returns {object} info from the current os\n */\nexport function releaseInfo(infoOptions: LinuxReleaseInfoOptions): object {\n const options = { ...linuxReleaseInfoOptionsDefaults, ...infoOptions };\n\n const searchOsReleaseFileList: string[] = osReleaseFileList(\n options.customFile,\n );\n\n if (os.type() !== \"Linux\") {\n if (options.mode === \"sync\") {\n return getOsInfo();\n } else {\n return Promise.resolve(getOsInfo());\n }\n }\n\n if (options.mode === \"sync\") {\n return readSyncOsreleaseFile(searchOsReleaseFileList, options);\n } else {\n return Promise.resolve(\n readAsyncOsReleaseFile(searchOsReleaseFileList, options),\n );\n }\n}\n\n/**\n * Format file data: convert data to object keys/values\n *\n * @param {object} sourceData Source object to be appended\n * @param {string} srcParseData Input file data to be parsed\n * @returns {object} Formated object\n */\nfunction formatFileData(sourceData: OsInfo, srcParseData: string): OsInfo {\n const lines: string[] = srcParseData.split(\"\\n\");\n\n for (const line of lines) {\n const lineData = line.split(\"=\");\n\n if (lineData.length === 2) {\n lineData[1] = lineData[1].replace(/[\"'\\r]/gi, \"\"); // remove quotes and return character\n\n Object.defineProperty(sourceData, lineData[0].toLowerCase(), {\n value: lineData[1],\n writable: true,\n enumerable: true,\n configurable: true,\n });\n }\n }\n\n return sourceData;\n}\n\n/**\n * Export a list of os-release files\n *\n * @param {string} customFile optional custom complete filepath\n * @returns {array} list of os-release files\n */\nfunction osReleaseFileList(customFile: string | null | undefined): string[] {\n const DEFAULT_OS_RELEASE_FILES = [\"/etc/os-release\", \"/usr/lib/os-release\"];\n\n if (!customFile) {\n return DEFAULT_OS_RELEASE_FILES;\n } else {\n return Array(customFile);\n }\n}\n\n/**\n * Operating system info.\n */\ntype OsInfo = {\n type: string;\n platform: string;\n hostname: string;\n arch: string;\n release: string;\n};\n\n/**\n * Get OS Basic Info\n * (uses node 'os' native module)\n *\n * @returns {OsInfo} os basic info\n */\nfunction getOsInfo(): OsInfo {\n return {\n type: os.type(),\n platform: os.platform(),\n hostname: os.hostname(),\n arch: os.arch(),\n release: os.release(),\n };\n}\n\n/* Helper functions */\n\nasync function readAsyncOsReleaseFile(\n fileList: string[],\n options: LinuxReleaseInfoOptions,\n): Promise {\n let fileData = null;\n\n for (const osReleaseFile of fileList) {\n try {\n if (options.debug) {\n /* eslint-disable no-console */\n console.log(`Trying to read '${osReleaseFile}'...`);\n }\n\n fileData = await readFileAsync(osReleaseFile, \"binary\");\n\n if (options.debug) {\n console.log(`Read data:\\n${fileData}`);\n }\n\n break;\n } catch (error) {\n if (options.debug) {\n console.error(error);\n }\n }\n }\n\n if (fileData === null) {\n throw new Error(\"Cannot read os-release file!\");\n //return getOsInfo();\n }\n\n return formatFileData(getOsInfo(), fileData);\n}\n\nfunction readSyncOsreleaseFile(\n releaseFileList: string[],\n options: LinuxReleaseInfoOptions,\n): OsInfo {\n let fileData = null;\n\n for (const osReleaseFile of releaseFileList) {\n try {\n if (options.debug) {\n console.log(`Trying to read '${osReleaseFile}'...`);\n }\n\n fileData = fs.readFileSync(osReleaseFile, \"binary\");\n\n if (options.debug) {\n console.log(`Read data:\\n${fileData}`);\n }\n\n break;\n } catch (error) {\n if (options.debug) {\n console.error(error);\n }\n }\n }\n\n if (fileData === null) {\n throw new Error(\"Cannot read os-release file!\");\n //return getOsInfo();\n }\n\n return formatFileData(getOsInfo(), fileData);\n}\n","// MIT, mostly lifted from https://github.com/actions/toolkit/blob/5a736647a123ecf8582376bdaee833fbae5b3847/packages/core/src/platform.ts\n// since it isn't in @actions/core 1.10.1 which is their current release as 2024-04-19.\n// Changes: Replaced the lsb_release call in Linux with `linux-release-info` to parse the os-release file directly.\nimport { releaseInfo } from \"./linux-release-info.js\";\nimport * as actionsCore from \"@actions/core\";\nimport * as exec from \"@actions/exec\";\nimport os from \"os\";\n\n/**\n * The name and version of the Action runner's system.\n */\ntype SystemInfo = {\n name: string;\n version: string;\n};\n\n/**\n * Get the name and version of the current Windows system.\n */\nconst getWindowsInfo = async (): Promise => {\n const { stdout: version } = await exec.getExecOutput(\n 'powershell -command \"(Get-CimInstance -ClassName Win32_OperatingSystem).Version\"',\n undefined,\n {\n silent: true,\n },\n );\n\n const { stdout: name } = await exec.getExecOutput(\n 'powershell -command \"(Get-CimInstance -ClassName Win32_OperatingSystem).Caption\"',\n undefined,\n {\n silent: true,\n },\n );\n\n return {\n name: name.trim(),\n version: version.trim(),\n };\n};\n\n/**\n * Get the name and version of the current macOS system.\n */\nconst getMacOsInfo = async (): Promise => {\n const { stdout } = await exec.getExecOutput(\"sw_vers\", undefined, {\n silent: true,\n });\n\n const version = stdout.match(/ProductVersion:\\s*(.+)/)?.[1] ?? \"\";\n const name = stdout.match(/ProductName:\\s*(.+)/)?.[1] ?? \"\";\n\n return {\n name,\n version,\n };\n};\n\n/**\n * Get the name and version of the current Linux system.\n */\nconst getLinuxInfo = async (): Promise => {\n let data: object = {};\n\n try {\n data = releaseInfo({ mode: \"sync\" });\n actionsCore.debug(`Identified release info: ${JSON.stringify(data)}`);\n } catch (e) {\n actionsCore.debug(`Error collecting release info: ${e}`);\n }\n\n return {\n name: getPropertyViaWithDefault(\n data,\n [\"id\", \"name\", \"pretty_name\", \"id_like\"],\n \"unknown\",\n ),\n version: getPropertyViaWithDefault(\n data,\n [\"version_id\", \"version\", \"version_codename\"],\n \"unknown\",\n ),\n };\n};\n\nfunction getPropertyViaWithDefault(\n data: object,\n names: Property[],\n defaultValue: T,\n): T {\n for (const name of names) {\n const ret: T = getPropertyWithDefault(data, name, defaultValue);\n\n if (ret !== defaultValue) {\n return ret;\n }\n }\n\n return defaultValue;\n}\n\nfunction getPropertyWithDefault(\n data: object,\n name: Property,\n defaultValue: T,\n): T {\n if (!data.hasOwnProperty(name)) {\n return defaultValue;\n }\n\n const value = (data as { [K in Property]: T })[name];\n\n // NB. this check won't work for object instances\n if (typeof value !== typeof defaultValue) {\n return defaultValue;\n }\n\n return value;\n}\n\n/**\n * The Action runner's platform.\n */\nexport const platform = os.platform();\n\n/**\n * The Action runner's architecture.\n */\nexport const arch = os.arch();\n\n/**\n * Whether the Action runner is a Windows system.\n */\nexport const isWindows = platform === \"win32\";\n\n/**\n * Whether the Action runner is a macOS system.\n */\nexport const isMacOS = platform === \"darwin\";\n\n/**\n * Whether the Action runner is a Linux system.\n */\nexport const isLinux = platform === \"linux\";\n\n/**\n * System-level information about the current host (platform, architecture, etc.).\n */\ntype SystemDetails = {\n name: string;\n platform: string;\n arch: string;\n version: string;\n isWindows: boolean;\n isMacOS: boolean;\n isLinux: boolean;\n};\n\n/**\n * Get system-level information about the current host (platform, architecture, etc.).\n */\nexport async function getDetails(): Promise {\n return {\n ...(await (isWindows\n ? getWindowsInfo()\n : isMacOS\n ? getMacOsInfo()\n : getLinuxInfo())),\n platform,\n arch,\n isWindows,\n isMacOS,\n isLinux,\n };\n}\n","import * as actionsCore from \"@actions/core\";\nimport { createHash } from \"node:crypto\";\n\nconst OPTIONAL_VARIABLES = [\"INVOCATION_ID\"];\n\n// JSON sent to server\n/* eslint-disable camelcase */\nexport type AnonymizedCorrelationHashes = {\n correlation_source: string;\n repository?: string;\n run?: string;\n run_differentiator?: string;\n workflow?: string;\n groups: Record;\n};\n\nexport function identify(projectName: string): AnonymizedCorrelationHashes {\n const ident = {\n correlation_source: \"github-actions\",\n\n repository: hashEnvironmentVariables(\"GHR\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n \"GITHUB_REPOSITORY\",\n \"GITHUB_REPOSITORY_ID\",\n ]),\n workflow: hashEnvironmentVariables(\"GHW\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n \"GITHUB_REPOSITORY\",\n \"GITHUB_REPOSITORY_ID\",\n \"GITHUB_WORKFLOW\",\n ]),\n job: hashEnvironmentVariables(\"GHWJ\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n \"GITHUB_REPOSITORY\",\n \"GITHUB_REPOSITORY_ID\",\n \"GITHUB_WORKFLOW\",\n \"GITHUB_JOB\",\n ]),\n run: hashEnvironmentVariables(\"GHWJR\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n \"GITHUB_REPOSITORY\",\n \"GITHUB_REPOSITORY_ID\",\n \"GITHUB_WORKFLOW\",\n \"GITHUB_JOB\",\n \"GITHUB_RUN_ID\",\n ]),\n run_differentiator: hashEnvironmentVariables(\"GHWJA\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n \"GITHUB_REPOSITORY\",\n \"GITHUB_REPOSITORY_ID\",\n \"GITHUB_WORKFLOW\",\n \"GITHUB_JOB\",\n \"GITHUB_RUN_ID\",\n \"GITHUB_RUN_NUMBER\",\n \"GITHUB_RUN_ATTEMPT\",\n \"INVOCATION_ID\",\n ]),\n groups: {\n ci: \"github-actions\",\n project: projectName,\n github_organization: hashEnvironmentVariables(\"GHO\", [\n \"GITHUB_SERVER_URL\",\n \"GITHUB_REPOSITORY_OWNER\",\n \"GITHUB_REPOSITORY_OWNER_ID\",\n ]),\n },\n };\n\n actionsCore.debug(\"Correlation data:\");\n actionsCore.debug(JSON.stringify(ident, null, 2));\n\n return ident;\n}\n\nfunction hashEnvironmentVariables(\n prefix: string,\n variables: string[],\n): undefined | string {\n const hash = createHash(\"sha256\");\n\n for (const varName of variables) {\n let value = process.env[varName];\n\n if (value === undefined) {\n if (OPTIONAL_VARIABLES.includes(varName)) {\n actionsCore.debug(\n `Optional environment variable not set: ${varName} -- substituting with the variable name`,\n );\n value = varName;\n } else {\n actionsCore.debug(\n `Environment variable not set: ${varName} -- can't generate the requested identity`,\n );\n return undefined;\n }\n }\n\n hash.update(value);\n hash.update(\"\\0\");\n }\n\n return `${prefix}-${hash.digest(\"hex\")}`;\n}\n","/**\n * @packageDocumentation\n * Helpers for determining system attributes of the current runner.\n */\nimport * as actionsCore from \"@actions/core\";\n\n/**\n * Get the current architecture plus OS. Examples include `X64-Linux` and `ARM64-macOS`.\n */\nexport function getArchOs(): string {\n const envArch = process.env.RUNNER_ARCH;\n const envOs = process.env.RUNNER_OS;\n\n if (envArch && envOs) {\n return `${envArch}-${envOs}`;\n } else {\n actionsCore.error(\n `Can't identify the platform: RUNNER_ARCH or RUNNER_OS undefined (${envArch}-${envOs})`,\n );\n throw new Error(\"RUNNER_ARCH and/or RUNNER_OS is not defined\");\n }\n}\n\n/**\n * Get the current Nix system. Examples include `x86_64-linux` and `aarch64-darwin`.\n */\nexport function getNixPlatform(archOs: string): string {\n const archOsMap: Map = new Map([\n [\"X64-macOS\", \"x86_64-darwin\"],\n [\"ARM64-macOS\", \"aarch64-darwin\"],\n [\"X64-Linux\", \"x86_64-linux\"],\n [\"ARM64-Linux\", \"aarch64-linux\"],\n ]);\n\n const mappedTo = archOsMap.get(archOs);\n if (mappedTo) {\n return mappedTo;\n } else {\n actionsCore.error(\n `ArchOs (${archOs}) doesn't map to a supported Nix platform.`,\n );\n throw new Error(\n `Cannot convert ArchOs (${archOs}) to a supported Nix platform.`,\n );\n }\n}\n","/**\n * @packageDocumentation\n * Helpers for getting values from an Action's configuration.\n */\nimport * as actionsCore from \"@actions/core\";\n\n/**\n * Get a Boolean input from the Action's configuration by name.\n */\nconst getBool = (name: string): boolean => {\n return actionsCore.getBooleanInput(name);\n};\n\n/**\n * Get a multi-line string input from the Action's configuration by name or return `null` if not set.\n */\nconst getMultilineStringOrNull = (name: string): string[] | null => {\n const value = actionsCore.getMultilineInput(name);\n if (value.length === 0) {\n return null;\n } else {\n return value;\n }\n};\n\n/**\n * Get a number input from the Action's configuration by name or return `null` if not set.\n */\nconst getNumberOrNull = (name: string): number | null => {\n const value = actionsCore.getInput(name);\n if (value === \"\") {\n return null;\n } else {\n return Number(value);\n }\n};\n\n/**\n * Get a string input from the Action's configuration.\n */\nconst getString = (name: string): string => {\n return actionsCore.getInput(name);\n};\n\n/**\n * Get a string input from the Action's configuration by name or return `null` if not set.\n */\nconst getStringOrNull = (name: string): string | null => {\n const value = actionsCore.getInput(name);\n if (value === \"\") {\n return null;\n } else {\n return value;\n }\n};\n\n/**\n * Get a string input from the Action's configuration by name or return `undefined` if not set.\n */\nconst getStringOrUndefined = (name: string): string | undefined => {\n const value = actionsCore.getInput(name);\n if (value === \"\") {\n return undefined;\n } else {\n return value;\n }\n};\n\nexport {\n getBool,\n getMultilineStringOrNull,\n getNumberOrNull,\n getString,\n getStringOrNull,\n getStringOrUndefined,\n};\n","import { getStringOrUndefined } from \"./inputs.js\";\nimport * as actionsCore from \"@actions/core\";\n\nexport type SourceDef = {\n path?: string;\n url?: string;\n tag?: string;\n pr?: string;\n branch?: string;\n revision?: string;\n};\n\nexport function constructSourceParameters(legacyPrefix?: string): SourceDef {\n const noisilyGetInput = (suffix: string): string | undefined => {\n const preferredInput = getStringOrUndefined(`source-${suffix}`);\n\n if (!legacyPrefix) {\n return preferredInput;\n }\n\n // Remaining is for handling cases where the legacy prefix\n // should be examined.\n const legacyInput = getStringOrUndefined(`${legacyPrefix}-${suffix}`);\n\n if (preferredInput && legacyInput) {\n actionsCore.warning(\n `The supported option source-${suffix} and the legacy option ${legacyPrefix}-${suffix} are both set. Preferring source-${suffix}. Please stop setting ${legacyPrefix}-${suffix}.`,\n );\n return preferredInput;\n } else if (legacyInput) {\n actionsCore.warning(\n `The legacy option ${legacyPrefix}-${suffix} is set. Please migrate to source-${suffix}.`,\n );\n return legacyInput;\n } else {\n return preferredInput;\n }\n };\n\n return {\n path: noisilyGetInput(\"path\"),\n url: noisilyGetInput(\"url\"),\n tag: noisilyGetInput(\"tag\"),\n pr: noisilyGetInput(\"pr\"),\n branch: noisilyGetInput(\"branch\"),\n revision: noisilyGetInput(\"revision\"),\n };\n}\n","/**\n * @packageDocumentation\n * Determinate Systems' TypeScript library for creating GitHub Actions logic.\n */\nimport { version as pkgVersion } from \"../package.json\";\nimport * as ghActionsCorePlatform from \"./actions-core-platform.js\";\nimport * as correlation from \"./correlation.js\";\nimport * as platform from \"./platform.js\";\nimport { SourceDef, constructSourceParameters } from \"./sourcedef.js\";\nimport * as actionsCache from \"@actions/cache\";\nimport * as actionsCore from \"@actions/core\";\nimport got, { Got } from \"got\";\nimport { UUID, randomUUID } from \"node:crypto\";\nimport { createWriteStream } from \"node:fs\";\nimport fs, { chmod, copyFile, mkdir } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport * as path from \"node:path\";\nimport { pipeline } from \"node:stream/promises\";\n\nconst DEFAULT_IDS_HOST = \"https://install.determinate.systems\";\nconst IDS_HOST = process.env[\"IDS_HOST\"] ?? DEFAULT_IDS_HOST;\n\nconst EVENT_EXCEPTION = \"exception\";\nconst EVENT_ARTIFACT_CACHE_HIT = \"artifact_cache_hit\";\nconst EVENT_ARTIFACT_CACHE_MISS = \"artifact_cache_miss\";\n\nconst FACT_ENDED_WITH_EXCEPTION = \"ended_with_exception\";\nconst FACT_FINAL_EXCEPTION = \"final_exception\";\n\nexport type FetchSuffixStyle = \"nix-style\" | \"gh-env-style\" | \"universal\";\nexport type ExecutionPhase = \"main\" | \"post\";\nexport type NixRequirementHandling = \"fail\" | \"warn\" | \"ignore\";\n\nexport type ActionOptions = {\n // Name of the project generally, and the name of the binary on disk.\n name: string;\n\n // Defaults to `name`, Corresponds to the ProjectHost entry on i.d.s.\n idsProjectName?: string;\n\n // Defaults to `action:`\n eventPrefix?: string;\n\n // The \"architecture\" URL component expected by I.D.S. for the ProjectHost.\n fetchStyle: FetchSuffixStyle;\n\n // IdsToolbox assumes the GitHub Action exposes source overrides, like branch/pr/etc. to be named `source-*`.\n // This prefix adds a fallback name, prefixed by `${legacySourcePrefix}-`.\n // Users who configure legacySourcePrefix will get warnings asking them to change to `source-*`.\n legacySourcePrefix?: string;\n\n // Check if Nix is installed before running this action.\n // If Nix isn't installed, this action will not fail, and will instead do nothing.\n // The action will emit a user-visible warning instructing them to install Nix.\n requireNix: NixRequirementHandling;\n\n // The URL to send diagnostics events to.\n // Specifically:\n // * `undefined` -> Attempt to read the `diagnostic-enpdoint` action input, and calculate the default diagnostics URL for IDS from there.\n // * `null` -> Disable sending diagnostics altogether.\n // * URL(...) -> Send diagnostics to this other URL instead\n diagnosticsUrl?: URL | null;\n};\n\n// A confident version of Options, where defaults have been resolved into final values\ntype ConfidentActionOptions = {\n name: string;\n idsProjectName: string;\n eventPrefix: string;\n fetchStyle: FetchSuffixStyle;\n legacySourcePrefix?: string;\n requireNix: NixRequirementHandling;\n diagnosticsUrl?: URL;\n};\n\ntype DiagnosticEvent = {\n event_name: string;\n correlation: correlation.AnonymizedCorrelationHashes;\n facts: Record;\n context: Record;\n timestamp: Date;\n uuid: UUID;\n};\n\nexport class IdsToolbox {\n private identity: correlation.AnonymizedCorrelationHashes;\n private actionOptions: ConfidentActionOptions;\n private archOs: string;\n private nixSystem: string;\n private architectureFetchSuffix: string;\n private executionPhase: ExecutionPhase;\n private sourceParameters: SourceDef;\n private facts: Record;\n private events: DiagnosticEvent[];\n private client: Got;\n\n private hookMain?: () => Promise;\n private hookPost?: () => Promise;\n\n constructor(actionOptions: ActionOptions) {\n this.actionOptions = makeOptionsConfident(actionOptions);\n this.hookMain = undefined;\n this.hookPost = undefined;\n\n this.events = [];\n this.client = got.extend({\n retry: {\n limit: 3,\n methods: [\"GET\", \"HEAD\"],\n },\n hooks: {\n beforeRetry: [\n (error, retryCount) => {\n actionsCore.info(\n `Retrying after error ${error.code}, retry #: ${retryCount}`,\n );\n },\n ],\n },\n });\n\n // JSON sent to server\n /* eslint-disable camelcase */\n this.facts = {\n $lib: \"idslib\",\n $lib_version: pkgVersion,\n project: this.actionOptions.name,\n ids_project: this.actionOptions.idsProjectName,\n };\n\n const params = [\n [\"github_action_ref\", \"GITHUB_ACTION_REF\"],\n [\"github_action_repository\", \"GITHUB_ACTION_REPOSITORY\"],\n [\"github_event_name\", \"GITHUB_EVENT_NAME\"],\n [\"$os\", \"RUNNER_OS\"],\n [\"arch\", \"RUNNER_ARCH\"],\n ];\n for (const [target, env] of params) {\n const value = process.env[env];\n if (value) {\n this.facts[target] = value;\n }\n }\n\n this.identity = correlation.identify(this.actionOptions.name);\n this.archOs = platform.getArchOs();\n this.nixSystem = platform.getNixPlatform(this.archOs);\n\n this.facts.arch_os = this.archOs;\n this.facts.nix_system = this.nixSystem;\n\n {\n ghActionsCorePlatform\n .getDetails()\n // eslint-disable-next-line github/no-then\n .then((details) => {\n if (details.name !== \"unknown\") {\n this.addFact(\"$os\", details.name);\n }\n if (details.version !== \"unknown\") {\n this.addFact(\"$os_version\", details.version);\n }\n })\n // eslint-disable-next-line github/no-then\n .catch((e) => {\n actionsCore.debug(`Failure getting platform details: ${e}`);\n });\n }\n\n {\n const phase = actionsCore.getState(\"idstoolbox_execution_phase\");\n if (phase === \"\") {\n actionsCore.saveState(\"idstoolbox_execution_phase\", \"post\");\n this.executionPhase = \"main\";\n } else {\n this.executionPhase = \"post\";\n }\n this.facts.execution_phase = this.executionPhase;\n }\n\n if (this.actionOptions.fetchStyle === \"gh-env-style\") {\n this.architectureFetchSuffix = this.archOs;\n } else if (this.actionOptions.fetchStyle === \"nix-style\") {\n this.architectureFetchSuffix = this.nixSystem;\n } else if (this.actionOptions.fetchStyle === \"universal\") {\n this.architectureFetchSuffix = \"universal\";\n } else {\n throw new Error(\n `fetchStyle ${this.actionOptions.fetchStyle} is not a valid style`,\n );\n }\n\n this.sourceParameters = constructSourceParameters(\n this.actionOptions.legacySourcePrefix,\n );\n\n this.recordEvent(`begin_${this.executionPhase}`);\n }\n\n onMain(callback: () => Promise): void {\n this.hookMain = callback;\n }\n\n onPost(callback: () => Promise): void {\n this.hookPost = callback;\n }\n\n execute(): void {\n // eslint-disable-next-line github/no-then\n this.executeAsync().catch((error: Error) => {\n // eslint-disable-next-line no-console\n console.log(error);\n process.exitCode = 1;\n });\n }\n\n private async executeAsync(): Promise {\n try {\n process.env.DETSYS_CORRELATION = JSON.stringify(\n this.getCorrelationHashes(),\n );\n\n if (!(await this.preflightRequireNix())) {\n this.recordEvent(\"preflight-require-nix-denied\");\n return;\n }\n\n if (this.executionPhase === \"main\" && this.hookMain) {\n await this.hookMain();\n } else if (this.executionPhase === \"post\" && this.hookPost) {\n await this.hookPost();\n }\n this.addFact(FACT_ENDED_WITH_EXCEPTION, false);\n } catch (error) {\n this.addFact(FACT_ENDED_WITH_EXCEPTION, true);\n\n const reportable =\n error instanceof Error || typeof error == \"string\"\n ? error.toString()\n : JSON.stringify(error);\n\n this.addFact(FACT_FINAL_EXCEPTION, reportable);\n\n if (this.executionPhase === \"post\") {\n actionsCore.warning(reportable);\n } else {\n actionsCore.setFailed(reportable);\n }\n\n this.recordEvent(EVENT_EXCEPTION);\n } finally {\n await this.complete();\n }\n }\n\n addFact(key: string, value: string | boolean): void {\n this.facts[key] = value;\n }\n\n getDiagnosticsUrl(): URL | undefined {\n return this.actionOptions.diagnosticsUrl;\n }\n\n getUniqueId(): string {\n return (\n this.identity.run_differentiator ||\n process.env.RUNNER_TRACKING_ID ||\n randomUUID()\n );\n }\n\n getCorrelationHashes(): correlation.AnonymizedCorrelationHashes {\n return this.identity;\n }\n\n recordEvent(eventName: string, context: Record = {}): void {\n this.events.push({\n event_name: `${this.actionOptions.eventPrefix}${eventName}`,\n context,\n correlation: this.identity,\n facts: this.facts,\n timestamp: new Date(),\n uuid: randomUUID(),\n });\n }\n\n async fetch(): Promise {\n actionsCore.startGroup(\n `Downloading ${this.actionOptions.name} for ${this.architectureFetchSuffix}`,\n );\n\n try {\n actionsCore.info(`Fetching from ${this.getUrl()}`);\n\n const correlatedUrl = this.getUrl();\n correlatedUrl.searchParams.set(\"ci\", \"github\");\n correlatedUrl.searchParams.set(\n \"correlation\",\n JSON.stringify(this.identity),\n );\n\n const versionCheckup = await this.client.head(correlatedUrl);\n if (versionCheckup.headers.etag) {\n const v = versionCheckup.headers.etag;\n\n actionsCore.debug(\n `Checking the tool cache for ${this.getUrl()} at ${v}`,\n );\n const cached = await this.getCachedVersion(v);\n if (cached) {\n this.facts[\"artifact_fetched_from_cache\"] = true;\n actionsCore.debug(`Tool cache hit.`);\n return cached;\n }\n }\n\n this.facts[\"artifact_fetched_from_cache\"] = false;\n\n actionsCore.debug(\n `No match from the cache, re-fetching from the redirect: ${versionCheckup.url}`,\n );\n\n const destFile = this.getTemporaryName();\n const fetchStream = this.client.stream(versionCheckup.url);\n\n await pipeline(\n fetchStream,\n createWriteStream(destFile, {\n encoding: \"binary\",\n mode: 0o755,\n }),\n );\n\n if (fetchStream.response?.headers.etag) {\n const v = fetchStream.response.headers.etag;\n\n try {\n await this.saveCachedVersion(v, destFile);\n } catch (e) {\n actionsCore.debug(`Error caching the artifact: ${e}`);\n }\n }\n\n return destFile;\n } finally {\n actionsCore.endGroup();\n }\n }\n\n async fetchExecutable(): Promise {\n const binaryPath = await this.fetch();\n await chmod(binaryPath, fs.constants.S_IXUSR | fs.constants.S_IXGRP);\n return binaryPath;\n }\n\n private async complete(): Promise {\n this.recordEvent(`complete_${this.executionPhase}`);\n await this.submitEvents();\n }\n\n private getUrl(): URL {\n const p = this.sourceParameters;\n\n if (p.url) {\n return new URL(p.url);\n }\n\n const fetchUrl = new URL(IDS_HOST);\n fetchUrl.pathname += this.actionOptions.idsProjectName;\n\n if (p.tag) {\n fetchUrl.pathname += `/tag/${p.tag}`;\n } else if (p.pr) {\n fetchUrl.pathname += `/pr/${p.pr}`;\n } else if (p.branch) {\n fetchUrl.pathname += `/branch/${p.branch}`;\n } else if (p.revision) {\n fetchUrl.pathname += `/rev/${p.revision}`;\n } else {\n fetchUrl.pathname += `/stable`;\n }\n\n fetchUrl.pathname += `/${this.architectureFetchSuffix}`;\n\n return fetchUrl;\n }\n\n private cacheKey(version: string): string {\n const cleanedVersion = version.replace(/[^a-zA-Z0-9-+.]/g, \"\");\n return `determinatesystem-${this.actionOptions.name}-${this.architectureFetchSuffix}-${cleanedVersion}`;\n }\n\n private async getCachedVersion(version: string): Promise {\n const startCwd = process.cwd();\n\n try {\n const tempDir = this.getTemporaryName();\n await mkdir(tempDir);\n process.chdir(tempDir);\n\n // extremely evil shit right here:\n process.env.GITHUB_WORKSPACE_BACKUP = process.env.GITHUB_WORKSPACE;\n delete process.env.GITHUB_WORKSPACE;\n\n if (\n await actionsCache.restoreCache(\n [this.actionOptions.name],\n this.cacheKey(version),\n [],\n undefined,\n true,\n )\n ) {\n this.recordEvent(EVENT_ARTIFACT_CACHE_HIT);\n return `${tempDir}/${this.actionOptions.name}`;\n }\n\n this.recordEvent(EVENT_ARTIFACT_CACHE_MISS);\n return undefined;\n } finally {\n process.env.GITHUB_WORKSPACE = process.env.GITHUB_WORKSPACE_BACKUP;\n delete process.env.GITHUB_WORKSPACE_BACKUP;\n process.chdir(startCwd);\n }\n }\n\n private async saveCachedVersion(\n version: string,\n toolPath: string,\n ): Promise {\n const startCwd = process.cwd();\n\n try {\n const tempDir = this.getTemporaryName();\n await mkdir(tempDir);\n process.chdir(tempDir);\n await copyFile(toolPath, `${tempDir}/${this.actionOptions.name}`);\n\n // extremely evil shit right here:\n process.env.GITHUB_WORKSPACE_BACKUP = process.env.GITHUB_WORKSPACE;\n delete process.env.GITHUB_WORKSPACE;\n\n await actionsCache.saveCache(\n [this.actionOptions.name],\n this.cacheKey(version),\n undefined,\n true,\n );\n this.recordEvent(EVENT_ARTIFACT_CACHE_HIT);\n } finally {\n process.env.GITHUB_WORKSPACE = process.env.GITHUB_WORKSPACE_BACKUP;\n delete process.env.GITHUB_WORKSPACE_BACKUP;\n process.chdir(startCwd);\n }\n }\n\n private async preflightRequireNix(): Promise {\n let nixLocation: string | undefined;\n\n const pathParts = (process.env[\"PATH\"] || \"\").split(\":\");\n for (const location of pathParts) {\n const candidateNix = path.join(location, \"nix\");\n\n try {\n await fs.access(candidateNix, fs.constants.X_OK);\n actionsCore.debug(`Found Nix at ${candidateNix}`);\n nixLocation = candidateNix;\n } catch {\n actionsCore.debug(`Nix not at ${candidateNix}`);\n }\n }\n this.addFact(\"nix_location\", nixLocation || \"\");\n\n if (this.actionOptions.requireNix === \"ignore\") {\n return true;\n }\n\n const currentNotFoundState = actionsCore.getState(\n \"idstoolbox_nix_not_found\",\n );\n if (currentNotFoundState === \"not-found\") {\n // It was previously not found, so don't run subsequent actions\n return false;\n }\n\n if (nixLocation !== undefined) {\n return true;\n }\n actionsCore.saveState(\"idstoolbox_nix_not_found\", \"not-found\");\n\n switch (this.actionOptions.requireNix) {\n case \"fail\":\n actionsCore.setFailed(\n \"This action can only be used when Nix is installed.\" +\n \" Add `- uses: DeterminateSystems/nix-installer-action@main` earlier in your workflow.\",\n );\n break;\n case \"warn\":\n actionsCore.warning(\n \"This action is in no-op mode because Nix is not installed.\" +\n \" Add `- uses: DeterminateSystems/nix-installer-action@main` earlier in your workflow.\",\n );\n break;\n }\n\n return false;\n }\n\n private async submitEvents(): Promise {\n if (!this.actionOptions.diagnosticsUrl) {\n actionsCore.debug(\n \"Diagnostics are disabled. Not sending the following events:\",\n );\n actionsCore.debug(JSON.stringify(this.events, undefined, 2));\n return;\n }\n\n const batch = {\n type: \"eventlog\",\n sent_at: new Date(),\n events: this.events,\n };\n\n try {\n await this.client.post(this.actionOptions.diagnosticsUrl, {\n json: batch,\n });\n } catch (error) {\n actionsCore.debug(`Error submitting diagnostics event: ${error}`);\n }\n this.events = [];\n }\n\n private getTemporaryName(): string {\n const _tmpdir = process.env[\"RUNNER_TEMP\"] || tmpdir();\n return path.join(_tmpdir, `${this.actionOptions.name}-${randomUUID()}`);\n }\n}\n\nfunction makeOptionsConfident(\n actionOptions: ActionOptions,\n): ConfidentActionOptions {\n const idsProjectName = actionOptions.idsProjectName ?? actionOptions.name;\n\n const finalOpts: ConfidentActionOptions = {\n name: actionOptions.name,\n idsProjectName,\n eventPrefix: actionOptions.eventPrefix || \"action:\",\n fetchStyle: actionOptions.fetchStyle,\n legacySourcePrefix: actionOptions.legacySourcePrefix,\n requireNix: actionOptions.requireNix,\n diagnosticsUrl: determineDiagnosticsUrl(\n idsProjectName,\n actionOptions.diagnosticsUrl,\n ),\n };\n\n actionsCore.debug(\"idslib options:\");\n actionsCore.debug(JSON.stringify(finalOpts, undefined, 2));\n\n return finalOpts;\n}\n\nfunction determineDiagnosticsUrl(\n idsProjectName: string,\n urlOption?: URL | null,\n): undefined | URL {\n if (urlOption === null) {\n // Disable diagnostict events\n return undefined;\n }\n\n if (urlOption !== undefined) {\n // Caller specified a specific diagnostics URL\n return urlOption;\n }\n\n {\n // Attempt to use the action input's diagnostic-endpoint option.\n\n // Note: we don't use actionsCore.getInput('diagnostic-endpoint') on purpose:\n // getInput silently converts absent data to an empty string.\n const providedDiagnosticEndpoint = process.env[\"INPUT_DIAGNOSTIC-ENDPOINT\"];\n if (providedDiagnosticEndpoint === \"\") {\n // User probably explicitly turned it off\n return undefined;\n }\n\n if (providedDiagnosticEndpoint !== undefined) {\n try {\n return mungeDiagnosticEndpoint(new URL(providedDiagnosticEndpoint));\n } catch (e) {\n actionsCore.info(\n `User-provided diagnostic endpoint ignored: not a valid URL: ${e}`,\n );\n }\n }\n }\n\n try {\n const diagnosticUrl = new URL(IDS_HOST);\n diagnosticUrl.pathname += idsProjectName;\n diagnosticUrl.pathname += \"/diagnostics\";\n return diagnosticUrl;\n } catch (e) {\n actionsCore.info(\n `Generated diagnostic endpoint ignored: not a valid URL: ${e}`,\n );\n }\n\n return undefined;\n}\n\nfunction mungeDiagnosticEndpoint(inputUrl: URL): URL {\n if (DEFAULT_IDS_HOST === IDS_HOST) {\n return inputUrl;\n }\n\n try {\n const defaultIdsHost = new URL(DEFAULT_IDS_HOST);\n const currentIdsHost = new URL(IDS_HOST);\n\n if (inputUrl.origin !== defaultIdsHost.origin) {\n return inputUrl;\n }\n\n inputUrl.protocol = currentIdsHost.protocol;\n inputUrl.host = currentIdsHost.host;\n inputUrl.username = currentIdsHost.username;\n inputUrl.password = currentIdsHost.password;\n\n return inputUrl;\n } catch (e) {\n actionsCore.info(`Default or overridden IDS host isn't a valid URL: ${e}`);\n }\n\n return inputUrl;\n}\n\n// Public exports from other files\nexport * as inputs from \"./inputs.js\";\nexport * as platform from \"./platform.js\";\n"],"mappings":";;;;;;;AAEE,cAAW;;;ACYb,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,SAAS,iBAAiB;AAE1B,IAAM,gBAAgB,UAAa,WAAQ;AAyB3C,IAAM,kCAA2D;AAAA,EAC/D,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,OAAO;AACT;AAQO,SAAS,YAAY,aAA8C;AACxE,QAAM,UAAU,EAAE,GAAG,iCAAiC,GAAG,YAAY;AAErE,QAAM,0BAAoC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E,QAAI,+BAA+B,IAAI;AAErC,aAAO;AAAA,IACT;AAEA,QAAI,+BAA+B,QAAW;AAC5C,UAAI;AACF,eAAO,wBAAwB,IAAI,IAAI,0BAA0B,CAAC;AAAA,MACpE,SAAS,GAAG;AACV,QAAY;AAAA,UACV,+DAA+D,CAAC;AAAA,QAClE;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI;AACF,UAAM,gBAAgB,IAAI,IAAI,QAAQ;AACtC,kBAAc,YAAY;AAC1B,kBAAc,YAAY;AAC1B,WAAO;AAAA,EACT,SAAS,GAAG;AACV,IAAY;AAAA,MACV,2DAA2D,CAAC;AAAA,IAC9D;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,wBAAwB,UAAoB;AACnD,MAAI,qBAAqB,UAAU;AACjC,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,iBAAiB,IAAI,IAAI,gBAAgB;AAC/C,UAAM,iBAAiB,IAAI,IAAI,QAAQ;AAEvC,QAAI,SAAS,WAAW,eAAe,QAAQ;AAC7C,aAAO;AAAA,IACT;AAEA,aAAS,WAAW,eAAe;AACnC,aAAS,OAAO,eAAe;AAC/B,aAAS,WAAW,eAAe;AACnC,aAAS,WAAW,eAAe;AAEnC,WAAO;AAAA,EACT,SAAS,GAAG;AACV,IAAY,kBAAK,qDAAqD,CAAC,EAAE;AAAA,EAC3E;AAEA,SAAO;AACT;","names":["error","os","version","platform","arch","actionsCore","actionsCore","actionsCore","actionsCore","actionsCore","fs","error","version"]} \ No newline at end of file diff --git a/src/actions-core-platform.ts b/src/actions-core-platform.ts index 3e24762..e8d0ed8 100644 --- a/src/actions-core-platform.ts +++ b/src/actions-core-platform.ts @@ -2,7 +2,7 @@ // since it isn't in @actions/core 1.10.1 which is their current release as 2024-04-19. // Changes: Replaced the lsb_release call in Linux with `linux-release-info` to parse the os-release file directly. import { releaseInfo } from "./linux-release-info.js"; -import * as core from "@actions/core"; +import * as actionsCore from "@actions/core"; import * as exec from "@actions/exec"; import os from "os"; @@ -65,10 +65,9 @@ const getLinuxInfo = async (): Promise => { try { data = releaseInfo({ mode: "sync" }); - // eslint-disable-next-line no-console - console.log(data); + actionsCore.debug(`Identified release info: ${JSON.stringify(data)}`); } catch (e) { - core.debug(`Error collecting release info: ${e}`); + actionsCore.debug(`Error collecting release info: ${e}`); } return { diff --git a/src/index.ts b/src/index.ts index 2b52c45..dcd71c6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -285,56 +285,66 @@ export class IdsToolbox { } async fetch(): Promise { - actionsCore.info(`Fetching from ${this.getUrl()}`); - - const correlatedUrl = this.getUrl(); - correlatedUrl.searchParams.set("ci", "github"); - correlatedUrl.searchParams.set( - "correlation", - JSON.stringify(this.identity), + actionsCore.startGroup( + `Downloading ${this.actionOptions.name} for ${this.architectureFetchSuffix}`, ); - const versionCheckup = await this.client.head(correlatedUrl); - if (versionCheckup.headers.etag) { - const v = versionCheckup.headers.etag; + try { + actionsCore.info(`Fetching from ${this.getUrl()}`); + + const correlatedUrl = this.getUrl(); + correlatedUrl.searchParams.set("ci", "github"); + correlatedUrl.searchParams.set( + "correlation", + JSON.stringify(this.identity), + ); + + const versionCheckup = await this.client.head(correlatedUrl); + if (versionCheckup.headers.etag) { + const v = versionCheckup.headers.etag; - actionsCore.debug(`Checking the tool cache for ${this.getUrl()} at ${v}`); - const cached = await this.getCachedVersion(v); - if (cached) { - this.facts["artifact_fetched_from_cache"] = true; - actionsCore.debug(`Tool cache hit.`); - return cached; + actionsCore.debug( + `Checking the tool cache for ${this.getUrl()} at ${v}`, + ); + const cached = await this.getCachedVersion(v); + if (cached) { + this.facts["artifact_fetched_from_cache"] = true; + actionsCore.debug(`Tool cache hit.`); + return cached; + } } - } - this.facts["artifact_fetched_from_cache"] = false; + this.facts["artifact_fetched_from_cache"] = false; - actionsCore.debug( - `No match from the cache, re-fetching from the redirect: ${versionCheckup.url}`, - ); + actionsCore.debug( + `No match from the cache, re-fetching from the redirect: ${versionCheckup.url}`, + ); - const destFile = this.getTemporaryName(); - const fetchStream = this.client.stream(versionCheckup.url); + const destFile = this.getTemporaryName(); + const fetchStream = this.client.stream(versionCheckup.url); - await pipeline( - fetchStream, - createWriteStream(destFile, { - encoding: "binary", - mode: 0o755, - }), - ); + await pipeline( + fetchStream, + createWriteStream(destFile, { + encoding: "binary", + mode: 0o755, + }), + ); - if (fetchStream.response?.headers.etag) { - const v = fetchStream.response.headers.etag; + if (fetchStream.response?.headers.etag) { + const v = fetchStream.response.headers.etag; - try { - await this.saveCachedVersion(v, destFile); - } catch (e) { - actionsCore.debug(`Error caching the artifact: ${e}`); + try { + await this.saveCachedVersion(v, destFile); + } catch (e) { + actionsCore.debug(`Error caching the artifact: ${e}`); + } } - } - return destFile; + return destFile; + } finally { + actionsCore.endGroup(); + } } async fetchExecutable(): Promise {