From 8ef3f8c93e35d2c38d2eae9fdc2ce219b4474f8a Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Wed, 29 May 2024 16:07:07 -0300 Subject: [PATCH] Fix direction of Boolean check --- action.yml | 1 + dist/index.js | 12 ++++++------ src/index.ts | 12 ++++++------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/action.yml b/action.yml index d925739..d3f7c14 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,7 @@ inputs: default: false force-docker-shim: description: Force the use of Docker as a process supervisor. This setting is automatically enabled when necessary. + required: false default: false github-token: description: A GitHub token for making authenticated requests (which have a higher rate-limit quota than unauthenticated requests) diff --git a/dist/index.js b/dist/index.js index 6a79287..11d49c8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -97864,14 +97864,14 @@ var NixInstallerAction = class extends DetSysAction { get isLinux() { return this.runnerOs === "Linux"; } - get runningInAct() { + get isRunningInAct() { return process.env["ACT"] !== void 0 && !(process.env["NOT_ACT"] === ""); } - get runningInNamespaceRunner() { + get isRunningInNamespaceRunner() { return process.env["NSC_VM_ID"] !== void 0 && !(process.env["NOT_NAMESPACE"] === "true"); } async detectAndForceDockerShim() { - if (this.isLinux) { + if (!this.isLinux) { if (this.forceDockerShim) { core.warning( "Ignoring force-docker-shim which is set to true, as it is only supported on Linux." @@ -97880,7 +97880,7 @@ var NixInstallerAction = class extends DetSysAction { } return; } - if (this.runningInAct) { + if (this.isRunningInAct) { core.debug( "Not bothering to detect if the docker shim should be used, as it is typically incompatible with act." ); @@ -98161,14 +98161,14 @@ ${stderrBuffer}` extraConf += "\n"; } executionEnv.NIX_INSTALLER_EXTRA_CONF = extraConf; - if (this.runningInAct) { + if (this.isRunningInAct) { this.addFact(FACT_IN_ACT, true); core.info( "Detected `$ACT` environment, assuming this is a https://github.com/nektos/act created container, set `NOT_ACT=true` to override this. This will change the setting of the `init` to be compatible with `act`" ); executionEnv.NIX_INSTALLER_INIT = "none"; } - if (this.runningInNamespaceRunner) { + if (this.isRunningInNamespaceRunner) { this.addFact(FACT_IN_NAMESPACE_SO, true); core.info( "Detected Namespace runner, assuming this is a https://namespace.so created container, set `NOT_NAMESPACE=true` to override this. This will change the setting of the `init` to be compatible with Namespace" diff --git a/src/index.ts b/src/index.ts index 3028607..8bce7f5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -133,11 +133,11 @@ class NixInstallerAction extends DetSysAction { return this.runnerOs === "Linux"; } - private get runningInAct(): boolean { + private get isRunningInAct(): boolean { return process.env["ACT"] !== undefined && !(process.env["NOT_ACT"] === ""); } - private get runningInNamespaceRunner(): boolean { + private get isRunningInNamespaceRunner(): boolean { return ( process.env["NSC_VM_ID"] !== undefined && !(process.env["NOT_NAMESPACE"] === "true") @@ -148,7 +148,7 @@ class NixInstallerAction extends DetSysAction { // Detect if we're in a GHA runner which is Linux, doesn't have Systemd, and does have Docker. // This is a common case in self-hosted runners, providers like [Namespace](https://namespace.so/), // and especially GitHub Enterprise Server. - if (this.isLinux) { + if (!this.isLinux) { if (this.forceDockerShim) { actionsCore.warning( "Ignoring force-docker-shim which is set to true, as it is only supported on Linux.", @@ -158,7 +158,7 @@ class NixInstallerAction extends DetSysAction { return; } - if (this.runningInAct) { + if (this.isRunningInAct) { actionsCore.debug( "Not bothering to detect if the docker shim should be used, as it is typically incompatible with act.", ); @@ -493,7 +493,7 @@ class NixInstallerAction extends DetSysAction { } executionEnv.NIX_INSTALLER_EXTRA_CONF = extraConf; - if (this.runningInAct) { + if (this.isRunningInAct) { this.addFact(FACT_IN_ACT, true); actionsCore.info( "Detected `$ACT` environment, assuming this is a https://github.com/nektos/act created container, set `NOT_ACT=true` to override this. This will change the setting of the `init` to be compatible with `act`", @@ -501,7 +501,7 @@ class NixInstallerAction extends DetSysAction { executionEnv.NIX_INSTALLER_INIT = "none"; } - if (this.runningInNamespaceRunner) { + if (this.isRunningInNamespaceRunner) { this.addFact(FACT_IN_NAMESPACE_SO, true); actionsCore.info( "Detected Namespace runner, assuming this is a https://namespace.so created container, set `NOT_NAMESPACE=true` to override this. This will change the setting of the `init` to be compatible with Namespace",