Skip to content

Commit 95167f6

Browse files
committed
getBooleanInput
1 parent 5a40f12 commit 95167f6

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

lib/cache-save.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import * as core from "@actions/core";
22
import * as cache from "@actions/cache";
33

4-
import { getCacheDirectory, isCacheEnabled, State } from "./cache-utils";
4+
import { getCacheDirectory, State } from "./cache-utils";
55

66
async function saveCache() {
7-
const cacheInput = core.getInput("cache");
7+
const enableCache = core.getBooleanInput("cache");
88

9-
if (!isCacheEnabled(cacheInput)) {
9+
if (!enableCache) {
1010
core.info(`Caching disabled, not saving cache.`);
1111
return;
1212
}

lib/cache-utils.js

-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ export const State = {
1111
CacheMatchedKey: "matched_key",
1212
};
1313

14-
export function isCacheEnabled(cacheInput) {
15-
cacheInput = cacheInput || "true";
16-
return cacheInput === "true";
17-
}
18-
1914
export async function getCacheDirectory() {
2015
// NOTE: The `cache path` command was introduced in Scarb 0.7.0. We do not want to break compatibility with older
2116
// versions yet, so we fall back to a well-known cache path if this command is not available.

lib/main.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ import {
99
import { downloadScarb } from "./download";
1010
import { getOsTriplet } from "./platform";
1111
import { restoreCache } from "./cache-restore";
12-
import { isCacheEnabled } from "./cache-utils";
1312

1413
export default async function main() {
1514
try {
1615
const scarbVersionInput = core.getInput("scarb-version");
1716
const toolVersionsPathInput = core.getInput("tool-versions");
1817
const scarbLockPathInput = core.getInput("scarb-lock");
19-
const cacheInput = core.getInput("cache");
18+
const enableCache = core.getBooleanInput("cache");
2019

2120
const { repo: scarbRepo, version: scarbVersion } = await determineVersion(
2221
scarbVersionInput,
@@ -50,7 +49,7 @@ export default async function main() {
5049

5150
core.setOutput("scarb-version", await getFullVersionFromScarb());
5251

53-
if (isCacheEnabled(cacheInput)) {
52+
if (enableCache) {
5453
await restoreCache(scarbLockPathInput).catch((e) => {
5554
core.error(
5655
`There was an error when restoring cache: ${

0 commit comments

Comments
 (0)