Convert to proper casing

This commit is contained in:
Luc Perkins 2024-04-15 17:38:17 -03:00
parent 404aa741f9
commit c1c09e0135
No known key found for this signature in database
GPG key ID: 16DB1108FB591835
3 changed files with 125 additions and 130 deletions

73
dist/index.js generated vendored
View file

@ -94611,61 +94611,60 @@ class FlakeCheckerAction {
fetchStyle: "gh-env-style",
diagnosticsUrl: new URL("https://install.determinate.systems/flake-checker/telemetry"),
});
this.flake_lock_path =
action_input_string_or_null("flake-lock-path") || "flake.lock";
this.nixpkgs_keys =
action_input_string_or_null("nixpkgs-keys") || "nixpkgs";
this.check_outdated = action_input_bool("check-outdated");
this.check_owner = action_input_bool("check-owner");
this.check_supported = action_input_bool("check-supported");
this.ignore_missing_flake_lock = action_input_bool("ignore-missing-flake-lock");
this.fail_mode = action_input_bool("fail-mode");
this.send_statistics = action_input_bool("send-statistics");
this.flakeLockPath =
actionInputStringOrNull("flake-lock-path") || "flake.lock";
this.nixpkgsKeys = actionInputStringOrNull("nixpkgs-keys") || "nixpkgs";
this.checkOutdated = actionInputBool("check-outdated");
this.checkOwner = actionInputBool("check-owner");
this.checkSupported = actionInputBool("check-supported");
this.ignoreMissingFlakeLock = actionInputBool("ignore-missing-flake-lock");
this.failMode = actionInputBool("fail-mode");
this.sendStatistics = actionInputBool("send-statistics");
}
async executionEnvironment() {
const execution_env = {};
execution_env.NIX_FLAKE_CHECKER_FLAKE_LOCK_PATH = this.flake_lock_path;
execution_env.NIX_FLAKE_CHECKER_NIXPKGS_KEYS = this.nixpkgs_keys;
if (!this.send_statistics) {
execution_env.NIX_FLAKE_CHECKER_NO_TELEMETRY = "false";
const executionEnv = {};
executionEnv.NIX_FLAKE_CHECKER_FLAKE_LOCK_PATH = this.flakeLockPath;
executionEnv.NIX_FLAKE_CHECKER_NIXPKGS_KEYS = this.nixpkgsKeys;
if (!this.sendStatistics) {
executionEnv.NIX_FLAKE_CHECKER_NO_TELEMETRY = "false";
}
if (!this.check_outdated) {
execution_env.NIX_FLAKE_CHECKER_CHECK_OUTDATED = "false";
if (!this.checkOutdated) {
executionEnv.NIX_FLAKE_CHECKER_CHECK_OUTDATED = "false";
}
if (!this.check_owner) {
execution_env.NIX_FLAKE_CHECKER_CHECK_OWNER = "false";
if (!this.checkOwner) {
executionEnv.NIX_FLAKE_CHECKER_CHECK_OWNER = "false";
}
if (!this.check_supported) {
execution_env.NIX_FLAKE_CHECKER_CHECK_SUPPORTED = "false";
if (!this.checkSupported) {
executionEnv.NIX_FLAKE_CHECKER_CHECK_SUPPORTED = "false";
}
if (!this.ignore_missing_flake_lock) {
execution_env.NIX_FLAKE_CHECKER_IGNORE_MISSING_FLAKE_LOCK = "false";
if (!this.ignoreMissingFlakeLock) {
executionEnv.NIX_FLAKE_CHECKER_IGNORE_MISSING_FLAKE_LOCK = "false";
}
if (this.fail_mode) {
execution_env.NIX_FLAKE_CHECKER_FAIL_MODE = "true";
if (this.failMode) {
executionEnv.NIX_FLAKE_CHECKER_FAIL_MODE = "true";
}
return execution_env;
return executionEnv;
}
async check() {
const binary_path = await this.idslib.fetchExecutable();
const execution_env = await this.executionEnvironment();
core.debug(`Execution environment: ${JSON.stringify(execution_env, null, 4)}`);
const exit_code = await exec.exec(binary_path, [], {
const binaryPath = await this.idslib.fetchExecutable();
const executionEnv = await this.executionEnvironment();
core.debug(`Execution environment: ${JSON.stringify(executionEnv, null, 4)}`);
const exitCode = await exec.exec(binaryPath, [], {
env: {
...execution_env,
...executionEnv,
...process.env, // To get $PATH, etc
},
});
if (exit_code !== 0) {
if (exitCode !== 0) {
this.idslib.recordEvent("execution_failure", {
exit_code,
exitCode,
});
throw new Error(`Non-zero exit code of \`${exit_code}\` detected`);
throw new Error(`Non-zero exit code of \`${exitCode}\` detected`);
}
return exit_code;
return exitCode;
}
}
function action_input_string_or_null(name) {
function actionInputStringOrNull(name) {
const value = core.getInput(name);
if (value === "") {
return null;
@ -94674,7 +94673,7 @@ function action_input_string_or_null(name) {
return value;
}
}
function action_input_bool(name) {
function actionInputBool(name) {
return core.getBooleanInput(name);
}
function main() {

81
dist/main.js generated vendored
View file

@ -1,5 +1,5 @@
import * as actions_core from "@actions/core";
import * as actions_exec from "@actions/exec";
import * as actionsCore from "@actions/core";
import * as actionsExec from "@actions/exec";
import { IdsToolbox } from "detsys-ts";
class FlakeCheckerAction {
constructor() {
@ -8,62 +8,61 @@ class FlakeCheckerAction {
fetchStyle: "gh-env-style",
diagnosticsUrl: new URL("https://install.determinate.systems/flake-checker/telemetry"),
});
this.flake_lock_path =
action_input_string_or_null("flake-lock-path") || "flake.lock";
this.nixpkgs_keys =
action_input_string_or_null("nixpkgs-keys") || "nixpkgs";
this.check_outdated = action_input_bool("check-outdated");
this.check_owner = action_input_bool("check-owner");
this.check_supported = action_input_bool("check-supported");
this.ignore_missing_flake_lock = action_input_bool("ignore-missing-flake-lock");
this.fail_mode = action_input_bool("fail-mode");
this.send_statistics = action_input_bool("send-statistics");
this.flakeLockPath =
actionInputStringOrNull("flake-lock-path") || "flake.lock";
this.nixpkgsKeys = actionInputStringOrNull("nixpkgs-keys") || "nixpkgs";
this.checkOutdated = actionInputBool("check-outdated");
this.checkOwner = actionInputBool("check-owner");
this.checkSupported = actionInputBool("check-supported");
this.ignoreMissingFlakeLock = actionInputBool("ignore-missing-flake-lock");
this.failMode = actionInputBool("fail-mode");
this.sendStatistics = actionInputBool("send-statistics");
}
async executionEnvironment() {
const execution_env = {};
execution_env.NIX_FLAKE_CHECKER_FLAKE_LOCK_PATH = this.flake_lock_path;
execution_env.NIX_FLAKE_CHECKER_NIXPKGS_KEYS = this.nixpkgs_keys;
if (!this.send_statistics) {
execution_env.NIX_FLAKE_CHECKER_NO_TELEMETRY = "false";
const executionEnv = {};
executionEnv.NIX_FLAKE_CHECKER_FLAKE_LOCK_PATH = this.flakeLockPath;
executionEnv.NIX_FLAKE_CHECKER_NIXPKGS_KEYS = this.nixpkgsKeys;
if (!this.sendStatistics) {
executionEnv.NIX_FLAKE_CHECKER_NO_TELEMETRY = "false";
}
if (!this.check_outdated) {
execution_env.NIX_FLAKE_CHECKER_CHECK_OUTDATED = "false";
if (!this.checkOutdated) {
executionEnv.NIX_FLAKE_CHECKER_CHECK_OUTDATED = "false";
}
if (!this.check_owner) {
execution_env.NIX_FLAKE_CHECKER_CHECK_OWNER = "false";
if (!this.checkOwner) {
executionEnv.NIX_FLAKE_CHECKER_CHECK_OWNER = "false";
}
if (!this.check_supported) {
execution_env.NIX_FLAKE_CHECKER_CHECK_SUPPORTED = "false";
if (!this.checkSupported) {
executionEnv.NIX_FLAKE_CHECKER_CHECK_SUPPORTED = "false";
}
if (!this.ignore_missing_flake_lock) {
execution_env.NIX_FLAKE_CHECKER_IGNORE_MISSING_FLAKE_LOCK = "false";
if (!this.ignoreMissingFlakeLock) {
executionEnv.NIX_FLAKE_CHECKER_IGNORE_MISSING_FLAKE_LOCK = "false";
}
if (this.fail_mode) {
execution_env.NIX_FLAKE_CHECKER_FAIL_MODE = "true";
if (this.failMode) {
executionEnv.NIX_FLAKE_CHECKER_FAIL_MODE = "true";
}
return execution_env;
return executionEnv;
}
async check() {
const binary_path = await this.idslib.fetchExecutable();
const execution_env = await this.executionEnvironment();
actions_core.debug(`Execution environment: ${JSON.stringify(execution_env, null, 4)}`);
const exit_code = await actions_exec.exec(binary_path, [], {
const binaryPath = await this.idslib.fetchExecutable();
const executionEnv = await this.executionEnvironment();
actionsCore.debug(`Execution environment: ${JSON.stringify(executionEnv, null, 4)}`);
const exitCode = await actionsExec.exec(binaryPath, [], {
env: {
...execution_env,
...executionEnv,
...process.env, // To get $PATH, etc
},
});
if (exit_code !== 0) {
if (exitCode !== 0) {
this.idslib.recordEvent("execution_failure", {
exit_code,
exitCode,
});
throw new Error(`Non-zero exit code of \`${exit_code}\` detected`);
throw new Error(`Non-zero exit code of \`${exitCode}\` detected`);
}
return exit_code;
return exitCode;
}
}
function action_input_string_or_null(name) {
const value = actions_core.getInput(name);
function actionInputStringOrNull(name) {
const value = actionsCore.getInput(name);
if (value === "") {
return null;
}
@ -71,8 +70,8 @@ function action_input_string_or_null(name) {
return value;
}
}
function action_input_bool(name) {
return actions_core.getBooleanInput(name);
function actionInputBool(name) {
return actionsCore.getBooleanInput(name);
}
function main() {
const checker = new FlakeCheckerAction();

View file

@ -1,17 +1,17 @@
import * as actions_core from "@actions/core";
import * as actions_exec from "@actions/exec";
import * as actionsCore from "@actions/core";
import * as actionsExec from "@actions/exec";
import { IdsToolbox } from "detsys-ts";
class FlakeCheckerAction {
idslib: IdsToolbox;
flake_lock_path: string;
nixpkgs_keys: string;
check_outdated: boolean;
check_owner: boolean;
check_supported: boolean;
ignore_missing_flake_lock: boolean;
fail_mode: boolean;
send_statistics: boolean;
flakeLockPath: string;
nixpkgsKeys: string;
checkOutdated: boolean;
checkOwner: boolean;
checkSupported: boolean;
ignoreMissingFlakeLock: boolean;
failMode: boolean;
sendStatistics: boolean;
constructor() {
this.idslib = new IdsToolbox({
@ -22,79 +22,76 @@ class FlakeCheckerAction {
),
});
this.flake_lock_path =
action_input_string_or_null("flake-lock-path") || "flake.lock";
this.nixpkgs_keys =
action_input_string_or_null("nixpkgs-keys") || "nixpkgs";
this.flakeLockPath =
actionInputStringOrNull("flake-lock-path") || "flake.lock";
this.nixpkgsKeys = actionInputStringOrNull("nixpkgs-keys") || "nixpkgs";
this.check_outdated = action_input_bool("check-outdated");
this.check_owner = action_input_bool("check-owner");
this.check_supported = action_input_bool("check-supported");
this.checkOutdated = actionInputBool("check-outdated");
this.checkOwner = actionInputBool("check-owner");
this.checkSupported = actionInputBool("check-supported");
this.ignore_missing_flake_lock = action_input_bool(
"ignore-missing-flake-lock",
);
this.ignoreMissingFlakeLock = actionInputBool("ignore-missing-flake-lock");
this.fail_mode = action_input_bool("fail-mode");
this.send_statistics = action_input_bool("send-statistics");
this.failMode = actionInputBool("fail-mode");
this.sendStatistics = actionInputBool("send-statistics");
}
private async executionEnvironment(): Promise<ExecuteEnvironment> {
const execution_env: ExecuteEnvironment = {};
const executionEnv: ExecuteEnvironment = {};
execution_env.NIX_FLAKE_CHECKER_FLAKE_LOCK_PATH = this.flake_lock_path;
execution_env.NIX_FLAKE_CHECKER_NIXPKGS_KEYS = this.nixpkgs_keys;
executionEnv.NIX_FLAKE_CHECKER_FLAKE_LOCK_PATH = this.flakeLockPath;
executionEnv.NIX_FLAKE_CHECKER_NIXPKGS_KEYS = this.nixpkgsKeys;
if (!this.send_statistics) {
execution_env.NIX_FLAKE_CHECKER_NO_TELEMETRY = "false";
if (!this.sendStatistics) {
executionEnv.NIX_FLAKE_CHECKER_NO_TELEMETRY = "false";
}
if (!this.check_outdated) {
execution_env.NIX_FLAKE_CHECKER_CHECK_OUTDATED = "false";
if (!this.checkOutdated) {
executionEnv.NIX_FLAKE_CHECKER_CHECK_OUTDATED = "false";
}
if (!this.check_owner) {
execution_env.NIX_FLAKE_CHECKER_CHECK_OWNER = "false";
if (!this.checkOwner) {
executionEnv.NIX_FLAKE_CHECKER_CHECK_OWNER = "false";
}
if (!this.check_supported) {
execution_env.NIX_FLAKE_CHECKER_CHECK_SUPPORTED = "false";
if (!this.checkSupported) {
executionEnv.NIX_FLAKE_CHECKER_CHECK_SUPPORTED = "false";
}
if (!this.ignore_missing_flake_lock) {
execution_env.NIX_FLAKE_CHECKER_IGNORE_MISSING_FLAKE_LOCK = "false";
if (!this.ignoreMissingFlakeLock) {
executionEnv.NIX_FLAKE_CHECKER_IGNORE_MISSING_FLAKE_LOCK = "false";
}
if (this.fail_mode) {
execution_env.NIX_FLAKE_CHECKER_FAIL_MODE = "true";
if (this.failMode) {
executionEnv.NIX_FLAKE_CHECKER_FAIL_MODE = "true";
}
return execution_env;
return executionEnv;
}
async check(): Promise<number> {
const binary_path = await this.idslib.fetchExecutable();
const binaryPath = await this.idslib.fetchExecutable();
const execution_env = await this.executionEnvironment();
actions_core.debug(
`Execution environment: ${JSON.stringify(execution_env, null, 4)}`,
const executionEnv = await this.executionEnvironment();
actionsCore.debug(
`Execution environment: ${JSON.stringify(executionEnv, null, 4)}`,
);
const exit_code = await actions_exec.exec(binary_path, [], {
const exitCode = await actionsExec.exec(binaryPath, [], {
env: {
...execution_env,
...executionEnv,
...process.env, // To get $PATH, etc
},
});
if (exit_code !== 0) {
if (exitCode !== 0) {
this.idslib.recordEvent("execution_failure", {
exit_code,
exitCode,
});
throw new Error(`Non-zero exit code of \`${exit_code}\` detected`);
throw new Error(`Non-zero exit code of \`${exitCode}\` detected`);
}
return exit_code;
return exitCode;
}
}
@ -111,8 +108,8 @@ type ExecuteEnvironment = {
NIX_FLAKE_CHECKER_FAIL_MODE?: string;
};
function action_input_string_or_null(name: string): string | null {
const value = actions_core.getInput(name);
function actionInputStringOrNull(name: string): string | null {
const value = actionsCore.getInput(name);
if (value === "") {
return null;
} else {
@ -120,8 +117,8 @@ function action_input_string_or_null(name: string): string | null {
}
}
function action_input_bool(name: string): boolean {
return actions_core.getBooleanInput(name);
function actionInputBool(name: string): boolean {
return actionsCore.getBooleanInput(name);
}
function main(): void {