mirror of
https://github.com/DeterminateSystems/magic-nix-cache-action.git
synced 2024-12-23 13:32:03 +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) {
|
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
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;
|
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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue