Skip to content

Commit 735686b

Browse files
committed
use state to transmit enabled input
1 parent 95167f6 commit 735686b

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

lib/cache-save.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as cache from "@actions/cache";
44
import { getCacheDirectory, State } from "./cache-utils";
55

66
async function saveCache() {
7-
const enableCache = core.getBooleanInput("cache");
7+
const enableCache = JSON.parse(core.getState(State.CacheEnabledKey));
88

99
if (!enableCache) {
1010
core.info(`Caching disabled, not saving cache.`);

lib/cache-utils.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import fs from "fs/promises";
99
export const State = {
1010
CachePrimaryKey: "primary_key",
1111
CacheMatchedKey: "matched_key",
12+
CacheEnabledKey: "cache_enabled",
1213
};
1314

1415
export async function getCacheDirectory() {

lib/main.js

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import { downloadScarb } from "./download";
1010
import { getOsTriplet } from "./platform";
1111
import { restoreCache } from "./cache-restore";
12+
import { State } from "./cache-utils";
1213

1314
export default async function main() {
1415
try {
@@ -49,6 +50,7 @@ export default async function main() {
4950

5051
core.setOutput("scarb-version", await getFullVersionFromScarb());
5152

53+
core.saveState(State.CacheEnabledKey, enableCache);
5254
if (enableCache) {
5355
await restoreCache(scarbLockPathInput).catch((e) => {
5456
core.error(

0 commit comments

Comments
 (0)