Move noop check to main

This commit is contained in:
Graham Christensen 2024-05-07 10:06:07 -04:00
parent f6084a76d3
commit c4a0b3111a
3 changed files with 20 additions and 29 deletions

20
dist/index.js generated vendored
View file

@ -94812,10 +94812,6 @@ var MagicNixCacheAction = class {
if (anyMissing) { if (anyMissing) {
return; return;
} }
if (this.noopMode) {
core.warning(NOOP_TEXT);
return;
}
if (this.daemonStarted) { if (this.daemonStarted) {
core.debug("Already started."); core.debug("Already started.");
return; return;
@ -94935,10 +94931,6 @@ var MagicNixCacheAction = class {
return `${lastPath}/bin/magic-nix-cache`; return `${lastPath}/bin/magic-nix-cache`;
} }
async notifyAutoCache() { async notifyAutoCache() {
if (this.noopMode) {
core.debug(NOOP_TEXT);
return;
}
if (!this.daemonStarted) { if (!this.daemonStarted) {
core.debug("magic-nix-cache not started - Skipping"); core.debug("magic-nix-cache not started - Skipping");
return; return;
@ -94955,10 +94947,6 @@ var MagicNixCacheAction = class {
} }
} }
async tearDownAutoCache() { async tearDownAutoCache() {
if (this.noopMode) {
core.warning(NOOP_TEXT);
return;
}
if (!this.daemonStarted) { if (!this.daemonStarted) {
core.debug("magic-nix-cache not started - Skipping"); core.debug("magic-nix-cache not started - Skipping");
return; return;
@ -94998,10 +94986,18 @@ var MagicNixCacheAction = class {
function main() { function main() {
const cacheAction = new MagicNixCacheAction(); const cacheAction = new MagicNixCacheAction();
cacheAction.idslib.onMain(async () => { cacheAction.idslib.onMain(async () => {
if (cacheAction.noopMode) {
core.warning(NOOP_TEXT);
return;
}
await cacheAction.setUpAutoCache(); await cacheAction.setUpAutoCache();
await cacheAction.notifyAutoCache(); await cacheAction.notifyAutoCache();
}); });
cacheAction.idslib.onPost(async () => { cacheAction.idslib.onPost(async () => {
if (cacheAction.noopMode) {
core.debug(NOOP_TEXT);
return;
}
await cacheAction.tearDownAutoCache(); await cacheAction.tearDownAutoCache();
}); });
cacheAction.idslib.execute(); cacheAction.idslib.execute();

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -26,7 +26,7 @@ class MagicNixCacheAction {
idslib: IdsToolbox; idslib: IdsToolbox;
private client: Got; private client: Got;
private noopMode: boolean; noopMode: boolean;
private daemonDir: string; private daemonDir: string;
private daemonStarted: boolean; private daemonStarted: boolean;
@ -100,11 +100,6 @@ class MagicNixCacheAction {
return; return;
} }
if (this.noopMode) {
actionsCore.warning(NOOP_TEXT);
return;
}
if (this.daemonStarted) { if (this.daemonStarted) {
actionsCore.debug("Already started."); actionsCore.debug("Already started.");
return; return;
@ -258,11 +253,6 @@ class MagicNixCacheAction {
} }
async notifyAutoCache(): Promise<void> { async notifyAutoCache(): Promise<void> {
if (this.noopMode) {
actionsCore.debug(NOOP_TEXT);
return;
}
if (!this.daemonStarted) { if (!this.daemonStarted) {
actionsCore.debug("magic-nix-cache not started - Skipping"); actionsCore.debug("magic-nix-cache not started - Skipping");
return; return;
@ -283,11 +273,6 @@ class MagicNixCacheAction {
} }
async tearDownAutoCache(): Promise<void> { async tearDownAutoCache(): Promise<void> {
if (this.noopMode) {
actionsCore.warning(NOOP_TEXT);
return;
}
if (!this.daemonStarted) { if (!this.daemonStarted) {
actionsCore.debug("magic-nix-cache not started - Skipping"); actionsCore.debug("magic-nix-cache not started - Skipping");
return; return;
@ -335,10 +320,20 @@ function main(): void {
const cacheAction = new MagicNixCacheAction(); const cacheAction = new MagicNixCacheAction();
cacheAction.idslib.onMain(async () => { cacheAction.idslib.onMain(async () => {
if (cacheAction.noopMode) {
actionsCore.warning(NOOP_TEXT);
return;
}
await cacheAction.setUpAutoCache(); await cacheAction.setUpAutoCache();
await cacheAction.notifyAutoCache(); await cacheAction.notifyAutoCache();
}); });
cacheAction.idslib.onPost(async () => { cacheAction.idslib.onPost(async () => {
if (cacheAction.noopMode) {
actionsCore.debug(NOOP_TEXT);
return;
}
await cacheAction.tearDownAutoCache(); await cacheAction.tearDownAutoCache();
}); });