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

81
dist/main.js generated vendored
View file

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

View file

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