mirror of
https://github.com/DeterminateSystems/nix-installer-action.git
synced 2024-11-22 11:23:12 +03:00
Provide better if statement
This commit is contained in:
parent
23e5c435a9
commit
9c4e8b237e
11
dist/index.js
generated
vendored
11
dist/index.js
generated
vendored
@ -97864,9 +97864,12 @@ var NixInstallerAction = class extends DetSysAction {
|
||||
get isLinux() {
|
||||
return this.runnerOs === "Linux";
|
||||
}
|
||||
get isAct() {
|
||||
get runningInAct() {
|
||||
return process.env["ACT"] !== "" && !(process.env["NOT_ACT"] === "");
|
||||
}
|
||||
get runningInNamespaceRunner() {
|
||||
return process.env["NSC_VM_ID"] !== void 0 && !(process.env["NOT_NAMESPACE"] === "true");
|
||||
}
|
||||
async detectAndForceDockerShim() {
|
||||
if (this.isLinux) {
|
||||
if (this.forceDockerShim) {
|
||||
@ -97877,7 +97880,7 @@ var NixInstallerAction = class extends DetSysAction {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.isAct) {
|
||||
if (this.runningInAct) {
|
||||
core.debug(
|
||||
"Not bothering to detect if the docker shim should be used, as it is typically incompatible with act."
|
||||
);
|
||||
@ -98158,14 +98161,14 @@ ${stderrBuffer}`
|
||||
extraConf += "\n";
|
||||
}
|
||||
executionEnv.NIX_INSTALLER_EXTRA_CONF = extraConf;
|
||||
if (process.env["ACT"] && !process.env["NOT_ACT"]) {
|
||||
if (this.runningInAct) {
|
||||
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 (process.env["NSC_VM_ID"] && !process.env["NOT_NAMESPACE"]) {
|
||||
if (this.runningInNamespaceRunner) {
|
||||
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"
|
||||
|
15
src/index.ts
15
src/index.ts
@ -133,10 +133,17 @@ class NixInstallerAction extends DetSysAction {
|
||||
return this.runnerOs === "Linux";
|
||||
}
|
||||
|
||||
private get isAct(): boolean {
|
||||
private get runningInAct(): boolean {
|
||||
return process.env["ACT"] !== "" && !(process.env["NOT_ACT"] === "");
|
||||
}
|
||||
|
||||
private get runningInNamespaceRunner(): boolean {
|
||||
return (
|
||||
process.env["NSC_VM_ID"] !== undefined &&
|
||||
!(process.env["NOT_NAMESPACE"] === "true")
|
||||
);
|
||||
}
|
||||
|
||||
async detectAndForceDockerShim(): Promise<void> {
|
||||
// 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/),
|
||||
@ -151,7 +158,7 @@ class NixInstallerAction extends DetSysAction {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isAct) {
|
||||
if (this.runningInAct) {
|
||||
actionsCore.debug(
|
||||
"Not bothering to detect if the docker shim should be used, as it is typically incompatible with act.",
|
||||
);
|
||||
@ -486,7 +493,7 @@ class NixInstallerAction extends DetSysAction {
|
||||
}
|
||||
executionEnv.NIX_INSTALLER_EXTRA_CONF = extraConf;
|
||||
|
||||
if (process.env["ACT"] && !process.env["NOT_ACT"]) {
|
||||
if (this.runningInAct) {
|
||||
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`",
|
||||
@ -494,7 +501,7 @@ class NixInstallerAction extends DetSysAction {
|
||||
executionEnv.NIX_INSTALLER_INIT = "none";
|
||||
}
|
||||
|
||||
if (process.env["NSC_VM_ID"] && !process.env["NOT_NAMESPACE"]) {
|
||||
if (this.runningInNamespaceRunner) {
|
||||
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",
|
||||
|
Loading…
Reference in New Issue
Block a user