mirror of
https://github.com/DeterminateSystems/magic-nix-cache-action.git
synced 2024-12-26 09:20:35 +01:00
Move noop check to main
This commit is contained in:
parent
f6084a76d3
commit
c4a0b3111a
3 changed files with 20 additions and 29 deletions
20
dist/index.js
generated
vendored
20
dist/index.js
generated
vendored
|
@ -94812,10 +94812,6 @@ var MagicNixCacheAction = class {
|
|||
if (anyMissing) {
|
||||
return;
|
||||
}
|
||||
if (this.noopMode) {
|
||||
core.warning(NOOP_TEXT);
|
||||
return;
|
||||
}
|
||||
if (this.daemonStarted) {
|
||||
core.debug("Already started.");
|
||||
return;
|
||||
|
@ -94935,10 +94931,6 @@ var MagicNixCacheAction = class {
|
|||
return `${lastPath}/bin/magic-nix-cache`;
|
||||
}
|
||||
async notifyAutoCache() {
|
||||
if (this.noopMode) {
|
||||
core.debug(NOOP_TEXT);
|
||||
return;
|
||||
}
|
||||
if (!this.daemonStarted) {
|
||||
core.debug("magic-nix-cache not started - Skipping");
|
||||
return;
|
||||
|
@ -94955,10 +94947,6 @@ var MagicNixCacheAction = class {
|
|||
}
|
||||
}
|
||||
async tearDownAutoCache() {
|
||||
if (this.noopMode) {
|
||||
core.warning(NOOP_TEXT);
|
||||
return;
|
||||
}
|
||||
if (!this.daemonStarted) {
|
||||
core.debug("magic-nix-cache not started - Skipping");
|
||||
return;
|
||||
|
@ -94998,10 +94986,18 @@ var MagicNixCacheAction = class {
|
|||
function main() {
|
||||
const cacheAction = new MagicNixCacheAction();
|
||||
cacheAction.idslib.onMain(async () => {
|
||||
if (cacheAction.noopMode) {
|
||||
core.warning(NOOP_TEXT);
|
||||
return;
|
||||
}
|
||||
await cacheAction.setUpAutoCache();
|
||||
await cacheAction.notifyAutoCache();
|
||||
});
|
||||
cacheAction.idslib.onPost(async () => {
|
||||
if (cacheAction.noopMode) {
|
||||
core.debug(NOOP_TEXT);
|
||||
return;
|
||||
}
|
||||
await cacheAction.tearDownAutoCache();
|
||||
});
|
||||
cacheAction.idslib.execute();
|
||||
|
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
27
src/index.ts
27
src/index.ts
|
@ -26,7 +26,7 @@ class MagicNixCacheAction {
|
|||
idslib: IdsToolbox;
|
||||
private client: Got;
|
||||
|
||||
private noopMode: boolean;
|
||||
noopMode: boolean;
|
||||
private daemonDir: string;
|
||||
private daemonStarted: boolean;
|
||||
|
||||
|
@ -100,11 +100,6 @@ class MagicNixCacheAction {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.noopMode) {
|
||||
actionsCore.warning(NOOP_TEXT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.daemonStarted) {
|
||||
actionsCore.debug("Already started.");
|
||||
return;
|
||||
|
@ -258,11 +253,6 @@ class MagicNixCacheAction {
|
|||
}
|
||||
|
||||
async notifyAutoCache(): Promise<void> {
|
||||
if (this.noopMode) {
|
||||
actionsCore.debug(NOOP_TEXT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.daemonStarted) {
|
||||
actionsCore.debug("magic-nix-cache not started - Skipping");
|
||||
return;
|
||||
|
@ -283,11 +273,6 @@ class MagicNixCacheAction {
|
|||
}
|
||||
|
||||
async tearDownAutoCache(): Promise<void> {
|
||||
if (this.noopMode) {
|
||||
actionsCore.warning(NOOP_TEXT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.daemonStarted) {
|
||||
actionsCore.debug("magic-nix-cache not started - Skipping");
|
||||
return;
|
||||
|
@ -335,10 +320,20 @@ function main(): void {
|
|||
const cacheAction = new MagicNixCacheAction();
|
||||
|
||||
cacheAction.idslib.onMain(async () => {
|
||||
if (cacheAction.noopMode) {
|
||||
actionsCore.warning(NOOP_TEXT);
|
||||
return;
|
||||
}
|
||||
|
||||
await cacheAction.setUpAutoCache();
|
||||
await cacheAction.notifyAutoCache();
|
||||
});
|
||||
cacheAction.idslib.onPost(async () => {
|
||||
if (cacheAction.noopMode) {
|
||||
actionsCore.debug(NOOP_TEXT);
|
||||
return;
|
||||
}
|
||||
|
||||
await cacheAction.tearDownAutoCache();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue