mirror of
https://github.com/DeterminateSystems/update-flake-lock.git
synced 2025-07-03 20:03:51 +03:00
Update detsys-ts
This commit is contained in:
parent
c16b76233e
commit
dccc3175bf
6 changed files with 89 additions and 134 deletions
168
dist/index.js
vendored
168
dist/index.js
vendored
|
@ -39513,7 +39513,7 @@ module.exports =
|
|||
{
|
||||
parallel : __nccwpck_require__(644),
|
||||
serial : __nccwpck_require__(4501),
|
||||
serialOrdered : __nccwpck_require__(3958)
|
||||
serialOrdered : __nccwpck_require__(2362)
|
||||
};
|
||||
|
||||
|
||||
|
@ -39844,7 +39844,7 @@ function parallel(list, iterator, callback)
|
|||
/***/ 4501:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
var serialOrdered = __nccwpck_require__(3958);
|
||||
var serialOrdered = __nccwpck_require__(2362);
|
||||
|
||||
// Public API
|
||||
module.exports = serial;
|
||||
|
@ -39865,7 +39865,7 @@ function serial(list, iterator, callback)
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3958:
|
||||
/***/ 2362:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
var iterate = __nccwpck_require__(5748)
|
||||
|
@ -93710,7 +93710,7 @@ const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(impo
|
|||
const external_node_stream_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:stream/promises");
|
||||
;// CONCATENATED MODULE: external "node:zlib"
|
||||
const external_node_zlib_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:zlib");
|
||||
;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@ed02129aed8e4d6402d920152652877189bece70_3whmnlhrx56zhgtsjnkrhnutfu/node_modules/detsys-ts/dist/index.js
|
||||
;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@1c510e3aff595c88769d3706895ecebbc625ff2c_5f3ck3sx4ossruvxt6hpzqrwhy/node_modules/detsys-ts/dist/index.js
|
||||
var __defProp = Object.defineProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
|
@ -94018,6 +94018,7 @@ function hashEnvironmentVariables(prefix, variables) {
|
|||
var inputs_exports = {};
|
||||
__export(inputs_exports, {
|
||||
getArrayOfStrings: () => getArrayOfStrings,
|
||||
getArrayOfStringsOrNull: () => getArrayOfStringsOrNull,
|
||||
getBool: () => getBool,
|
||||
getMultilineStringOrNull: () => getMultilineStringOrNull,
|
||||
getNumberOrNull: () => getNumberOrNull,
|
||||
|
@ -94034,6 +94035,14 @@ var getArrayOfStrings = (name, separator) => {
|
|||
const original = getString(name);
|
||||
return handleString(original, separator);
|
||||
};
|
||||
var getArrayOfStringsOrNull = (name, separator) => {
|
||||
const original = getStringOrNull(name);
|
||||
if (original === null) {
|
||||
return null;
|
||||
} else {
|
||||
return handleString(original, separator);
|
||||
}
|
||||
};
|
||||
var handleString = (input, separator) => {
|
||||
const sepChar = separator === "comma" ? "," : /\s+/;
|
||||
const trimmed = input.trim();
|
||||
|
@ -94172,6 +94181,7 @@ var EVENT_ARTIFACT_CACHE_HIT = "artifact_cache_hit";
|
|||
var EVENT_ARTIFACT_CACHE_MISS = "artifact_cache_miss";
|
||||
var EVENT_ARTIFACT_CACHE_PERSIST = "artifact_cache_persist";
|
||||
var EVENT_PREFLIGHT_REQUIRE_NIX_DENIED = "preflight-require-nix-denied";
|
||||
var FACT_ARTIFACT_FETCHED_FROM_CACHE = "artifact_fetched_from_cache";
|
||||
var FACT_ENDED_WITH_EXCEPTION = "ended_with_exception";
|
||||
var FACT_FINAL_EXCEPTION = "final_exception";
|
||||
var FACT_OS = "$os";
|
||||
|
@ -94284,16 +94294,6 @@ var DetSysAction = class {
|
|||
stapleFile(name, location) {
|
||||
this.exceptionAttachments.set(name, location);
|
||||
}
|
||||
setExecutionPhase() {
|
||||
const phase = core.getState(STATE_KEY_EXECUTION_PHASE);
|
||||
if (phase === "") {
|
||||
core.saveState(STATE_KEY_EXECUTION_PHASE, "post");
|
||||
this.executionPhase = "main";
|
||||
} else {
|
||||
this.executionPhase = "post";
|
||||
}
|
||||
this.facts.execution_phase = this.executionPhase;
|
||||
}
|
||||
/**
|
||||
* Execute the Action as defined.
|
||||
*/
|
||||
|
@ -94303,7 +94303,55 @@ var DetSysAction = class {
|
|||
process.exitCode = 1;
|
||||
});
|
||||
}
|
||||
// Whether the
|
||||
getTemporaryName() {
|
||||
const tmpDir = process.env["RUNNER_TEMP"] || (0,external_node_os_.tmpdir)();
|
||||
return external_node_path_namespaceObject.join(tmpDir, `${this.actionOptions.name}-${(0,external_node_crypto_namespaceObject.randomUUID)()}`);
|
||||
}
|
||||
addFact(key, value) {
|
||||
this.facts[key] = value;
|
||||
}
|
||||
getDiagnosticsUrl() {
|
||||
return this.actionOptions.diagnosticsUrl;
|
||||
}
|
||||
getUniqueId() {
|
||||
return this.identity.run_differentiator || process.env.RUNNER_TRACKING_ID || (0,external_node_crypto_namespaceObject.randomUUID)();
|
||||
}
|
||||
getCorrelationHashes() {
|
||||
return this.identity;
|
||||
}
|
||||
recordEvent(eventName, context = {}) {
|
||||
this.events.push({
|
||||
event_name: `${this.actionOptions.eventPrefix}${eventName}`,
|
||||
context,
|
||||
correlation: this.identity,
|
||||
facts: this.facts,
|
||||
timestamp: /* @__PURE__ */ new Date(),
|
||||
uuid: (0,external_node_crypto_namespaceObject.randomUUID)()
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Unpacks the closure returned by `fetchArtifact()`, imports the
|
||||
* contents into the Nix store, and returns the path of the executable at
|
||||
* `/nix/store/STORE_PATH/bin/${bin}`.
|
||||
*/
|
||||
async unpackClosure(bin) {
|
||||
const artifact = await this.fetchArtifact();
|
||||
const { stdout } = await (0,external_node_util_.promisify)(external_node_child_process_namespaceObject.exec)(
|
||||
`cat "${artifact}" | xz -d | nix-store --import`
|
||||
);
|
||||
const paths = stdout.split(external_node_os_.EOL);
|
||||
const lastPath = paths.at(-2);
|
||||
return `${lastPath}/bin/${bin}`;
|
||||
}
|
||||
/**
|
||||
* Fetches the executable at the URL determined by the `source-*` inputs and
|
||||
* other facts, `chmod`s it, and returns the path to the executable on disk.
|
||||
*/
|
||||
async fetchExecutable() {
|
||||
const binaryPath = await this.fetchArtifact();
|
||||
await (0,promises_namespaceObject.chmod)(binaryPath, promises_namespaceObject.constants.S_IXUSR | promises_namespaceObject.constants.S_IXGRP);
|
||||
return binaryPath;
|
||||
}
|
||||
get isMain() {
|
||||
return this.executionPhase === "main";
|
||||
}
|
||||
|
@ -94359,52 +94407,25 @@ var DetSysAction = class {
|
|||
await this.complete();
|
||||
}
|
||||
}
|
||||
addFact(key, value) {
|
||||
this.facts[key] = value;
|
||||
}
|
||||
getDiagnosticsUrl() {
|
||||
return this.actionOptions.diagnosticsUrl;
|
||||
}
|
||||
getUniqueId() {
|
||||
return this.identity.run_differentiator || process.env.RUNNER_TRACKING_ID || (0,external_node_crypto_namespaceObject.randomUUID)();
|
||||
}
|
||||
getCorrelationHashes() {
|
||||
return this.identity;
|
||||
}
|
||||
recordEvent(eventName, context = {}) {
|
||||
this.events.push({
|
||||
event_name: `${this.actionOptions.eventPrefix}${eventName}`,
|
||||
context,
|
||||
correlation: this.identity,
|
||||
facts: this.facts,
|
||||
timestamp: /* @__PURE__ */ new Date(),
|
||||
uuid: (0,external_node_crypto_namespaceObject.randomUUID)()
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Fetches a file in `.xz` format, imports its contents into the Nix store,
|
||||
* and returns the path of the executable at `/nix/store/STORE_PATH/bin/${bin}`.
|
||||
*/
|
||||
async unpackClosure(bin) {
|
||||
const artifact = this.fetchArtifact();
|
||||
const { stdout } = await (0,external_node_util_.promisify)(external_node_child_process_namespaceObject.exec)(
|
||||
`cat "${artifact}" | xz -d | nix-store --import`
|
||||
);
|
||||
const paths = stdout.split(external_node_os_.EOL);
|
||||
const lastPath = paths.at(-2);
|
||||
return `${lastPath}/bin/${bin}`;
|
||||
}
|
||||
/**
|
||||
* Fetch an artifact, such as a tarball, from the URL determined by the `source-*`
|
||||
* inputs and other factors.
|
||||
* Fetch an artifact, such as a tarball, from the location determined by the
|
||||
* `source-*` inputs. If `source-binary` is specified, this will return a path
|
||||
* to a binary on disk; otherwise, the artifact will be downloaded from the
|
||||
* URL determined by the other `source-*` inputs (`source-url`, `source-pr`,
|
||||
* etc.).
|
||||
*/
|
||||
async fetchArtifact() {
|
||||
const sourceBinary = getStringOrNull("source-binary");
|
||||
if (sourceBinary !== null && sourceBinary !== "") {
|
||||
core.debug(`Using the provided source binary at ${sourceBinary}`);
|
||||
return sourceBinary;
|
||||
}
|
||||
core.startGroup(
|
||||
`Downloading ${this.actionOptions.name} for ${this.architectureFetchSuffix}`
|
||||
);
|
||||
try {
|
||||
core.info(`Fetching from ${this.getUrl()}`);
|
||||
const correlatedUrl = this.getUrl();
|
||||
core.info(`Fetching from ${this.getSourceUrl()}`);
|
||||
const correlatedUrl = this.getSourceUrl();
|
||||
correlatedUrl.searchParams.set("ci", "github");
|
||||
correlatedUrl.searchParams.set(
|
||||
"correlation",
|
||||
|
@ -94415,16 +94436,16 @@ var DetSysAction = class {
|
|||
const v = versionCheckup.headers.etag;
|
||||
this.addFact(FACT_SOURCE_URL_ETAG, v);
|
||||
core.debug(
|
||||
`Checking the tool cache for ${this.getUrl()} at ${v}`
|
||||
`Checking the tool cache for ${this.getSourceUrl()} at ${v}`
|
||||
);
|
||||
const cached = await this.getCachedVersion(v);
|
||||
if (cached) {
|
||||
this.facts["artifact_fetched_from_cache"] = true;
|
||||
this.facts[FACT_ARTIFACT_FETCHED_FROM_CACHE] = true;
|
||||
core.debug(`Tool cache hit.`);
|
||||
return cached;
|
||||
}
|
||||
}
|
||||
this.facts["artifact_fetched_from_cache"] = false;
|
||||
this.facts[FACT_ARTIFACT_FETCHED_FROM_CACHE] = false;
|
||||
core.debug(
|
||||
`No match from the cache, re-fetching from the redirect: ${versionCheckup.url}`
|
||||
);
|
||||
|
@ -94450,15 +94471,6 @@ var DetSysAction = class {
|
|||
core.endGroup();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Fetches the executable at the URL determined by the `source-*` inputs and
|
||||
* other facts, `chmod`s it, and returns the path to the executable on disk.
|
||||
*/
|
||||
async fetchExecutable() {
|
||||
const binaryPath = await this.fetchArtifact();
|
||||
await (0,promises_namespaceObject.chmod)(binaryPath, promises_namespaceObject.constants.S_IXUSR | promises_namespaceObject.constants.S_IXGRP);
|
||||
return binaryPath;
|
||||
}
|
||||
/**
|
||||
* A helper function for failing on error only if strict mode is enabled.
|
||||
* This is intended only for CI environments testing Actions themselves.
|
||||
|
@ -94472,7 +94484,7 @@ var DetSysAction = class {
|
|||
this.recordEvent(`complete_${this.executionPhase}`);
|
||||
await this.submitEvents();
|
||||
}
|
||||
getUrl() {
|
||||
getSourceUrl() {
|
||||
const p = this.sourceParameters;
|
||||
if (p.url) {
|
||||
this.addFact(FACT_SOURCE_URL, p.url);
|
||||
|
@ -94657,10 +94669,6 @@ var DetSysAction = class {
|
|||
}
|
||||
this.events = [];
|
||||
}
|
||||
getTemporaryName() {
|
||||
const _tmpdir = process.env["RUNNER_TEMP"] || (0,external_node_os_.tmpdir)();
|
||||
return external_node_path_namespaceObject.join(_tmpdir, `${this.actionOptions.name}-${(0,external_node_crypto_namespaceObject.randomUUID)()}`);
|
||||
}
|
||||
};
|
||||
function stringifyError(error2) {
|
||||
return error2 instanceof Error || typeof error2 == "string" ? error2.toString() : JSON.stringify(error2);
|
||||
|
@ -94754,17 +94762,6 @@ function mungeDiagnosticEndpoint(inputUrl) {
|
|||
// EXTERNAL MODULE: external "fs"
|
||||
var external_fs_ = __nccwpck_require__(7147);
|
||||
;// CONCATENATED MODULE: ./dist/index.js
|
||||
// src/inputs.ts
|
||||
function determineFlakeDirectories(input) {
|
||||
const sepChar = /\s+/;
|
||||
const trimmed = input.trim();
|
||||
if (trimmed === "") {
|
||||
return [];
|
||||
} else {
|
||||
return trimmed.split(sepChar).map((s) => s.trim());
|
||||
}
|
||||
}
|
||||
|
||||
// src/nix.ts
|
||||
function makeNixCommandArgs(nixOptions, flakeInputs, commitMessage) {
|
||||
const flakeInputFlags = flakeInputs.flatMap((input) => [
|
||||
|
@ -94792,12 +94789,7 @@ var UpdateFlakeLockAction = class extends DetSysAction {
|
|||
this.flakeInputs = inputs_exports.getArrayOfStrings("inputs", "space");
|
||||
this.nixOptions = inputs_exports.getArrayOfStrings("nix-options", "space");
|
||||
this.pathToFlakeDir = inputs_exports.getStringOrNull("path-to-flake-dir");
|
||||
const flakeDirsInput = inputs_exports.getStringOrNull("flake-dirs");
|
||||
if (flakeDirsInput !== null) {
|
||||
this.flakeDirs = determineFlakeDirectories(flakeDirsInput);
|
||||
} else {
|
||||
this.flakeDirs = null;
|
||||
}
|
||||
this.flakeDirs = inputs_exports.getArrayOfStringsOrNull("flake-dirs", "space");
|
||||
this.validateInputs();
|
||||
}
|
||||
async main() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue