From cddf736ff4e1822b8a102de05ddb09846eec07cb Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 7 May 2024 09:37:28 -0400 Subject: [PATCH] Move the started state to a statevar not an env var --- src/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 39aef9c..db9df9c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,8 +11,7 @@ import * as path from "node:path"; import { inspect, promisify } from "node:util"; const ENV_CACHE_DAEMONDIR = "MAGIC_NIX_CACHE_DAEMONDIR"; -const ENV_CACHE_STARTED = "MAGIC_NIX_CACHE_STARTED"; - +const STATE_STARTED = "MAGIC_NIX_CACHE_STARTED"; const STARTED_HINT = "true"; class MagicNixCacheAction { @@ -46,7 +45,7 @@ class MagicNixCacheAction { }, }); - this.daemonStarted = process.env[ENV_CACHE_STARTED] === STARTED_HINT; + this.daemonStarted = actionsCore.getState(STATE_STARTED) === STARTED_HINT; if (process.env[ENV_CACHE_DAEMONDIR]) { this.daemonDir = process.env[ENV_CACHE_DAEMONDIR]; @@ -88,7 +87,7 @@ class MagicNixCacheAction { ); this.daemonStarted = true; - actionsCore.exportVariable(ENV_CACHE_STARTED, STARTED_HINT); + actionsCore.saveState(STATE_STARTED, STARTED_HINT); const sourceBinary = inputs.getStringOrNull("source-binary"); const daemonBin = sourceBinary !== null ? sourceBinary : await this.fetchAutoCacher();