From 07457a889a1f9dd1a44591199a48bfa2de9676b2 Mon Sep 17 00:00:00 2001 From: Stephan Boyer Date: Mon, 1 Jul 2024 00:47:38 -0700 Subject: [PATCH] Use Toast defaults in the GitHub action rather than hardcoded defaults --- .github/actions/toast/action.yml | 4 ++-- .github/actions/toast/index.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/toast/action.yml b/.github/actions/toast/action.yml index a6d9325..7c89f58 100644 --- a/.github/actions/toast/action.yml +++ b/.github/actions/toast/action.yml @@ -16,11 +16,11 @@ inputs: read_remote_cache: description: 'Whether to read from the Docker repository for remote caching' required: true - default: 'false' + default: '' write_remote_cache: description: 'Whether to write to the Docker repository for remote caching' required: true - default: 'false' + default: '' runs: using: node20 main: index.js diff --git a/.github/actions/toast/index.js b/.github/actions/toast/index.js index 1b72e67..28f0f4b 100644 --- a/.github/actions/toast/index.js +++ b/.github/actions/toast/index.js @@ -14,8 +14,8 @@ const writeRemoteCacheInput = core.getInput('write_remote_cache').trim(); const tasks = tasksInput === '' ? null : tasksInput.split(/\s+/); const file = fileInput === '' ? null : fileInput; const dockerRepo = dockerRepoInput === '' ? null : dockerRepoInput; -const readRemoteCache = readRemoteCacheInput == 'true'; -const writeRemoteCache = writeRemoteCacheInput == 'true'; +const readRemoteCache = readRemoteCacheInput === '' ? null : readRemoteCacheInput.toLowerCase() === 'true'; +const writeRemoteCache = writeRemoteCacheInput === '' ? null : writeRemoteCacheInput.toLowerCase() === 'true'; // Where to install Toast const toastPrefix = process.env.HOME; @@ -39,8 +39,8 @@ childProcess.execSync( const taskArgs = tasks === null ? [] : tasks; const fileArgs = file === null ? [] : ['--file', file]; const dockerRepoArgs = dockerRepo === null ? [] : ['--docker-repo', dockerRepo]; -const readRemoteCacheArgs = readRemoteCache ? ['--read-remote-cache', 'true'] : []; -const writeRemoteCacheArgs = writeRemoteCache ? ['--write-remote-cache', 'true'] : []; +const readRemoteCacheArgs = readRemoteCache === null ? [] : ['--read-remote-cache', readRemoteCache.toString()]; +const writeRemoteCacheArgs = writeRemoteCache === null ? [] : ['--write-remote-cache', writeRemoteCache.toString()]; // Run Toast. try {