diff --git a/README.md b/README.md index 3a915fb..5a5f705 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ Create a workflow `.yml` file in your repositories `.github/workflows` directory ### Inputs -- `use-cache` - A boolean value to enable/disable conditional page build. - `key` - An explicit key for restoring and saving the cache. - `restore-keys` - An ordered list of keys to use for restoring stale cache if no cache hit occurred for key. diff --git a/action.yml b/action.yml index 29977f7..50c10ce 100644 --- a/action.yml +++ b/action.yml @@ -2,10 +2,6 @@ name: "Gatsby Cache" description: "Cache build outputs for Gatsby's Conditional Page Build." author: "jongwooo " inputs: - use-cache: - description: "A boolean value to enable/disable conditional page build." - required: false - default: true key: description: "An explicit key for restoring and saving the cache." required: false diff --git a/dist/restore/index.js b/dist/restore/index.js index d31b8a3..75554c2 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -63186,8 +63186,7 @@ async function restoreImpl(stateProvider) { utils.logWarning(`Event Validation Error: The event type ${eventName} is not supported because it's not tied to a branch or tag ref.`); return; } - const useCache = core.getBooleanInput(constants_1.Inputs.UseCache); - utils.setBuildMode(useCache); + utils.setConditionalPageBuild(); const cachePaths = await utils.getBuildOutputPaths(); const restoreKeys = utils.getInputAsArray(constants_1.Inputs.RestoreKeys); let primaryKey = core.getInput(constants_1.Inputs.Key); @@ -63299,7 +63298,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getBuildOutputPaths = exports.setBuildMode = exports.isCacheFeatureAvailable = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0; +exports.getBuildOutputPaths = exports.setConditionalPageBuild = exports.isCacheFeatureAvailable = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0; const cache = __importStar(__nccwpck_require__(7799)); const core = __importStar(__nccwpck_require__(2186)); const path_1 = __importDefault(__nccwpck_require__(1017)); @@ -63347,10 +63346,11 @@ Otherwise please upgrade to GHES version >= 3.5 and If you are also using Github return false; } exports.isCacheFeatureAvailable = isCacheFeatureAvailable; -function setBuildMode(useCache) { - process.env[constants_1.Gatsby.Env] = String(useCache); +function setConditionalPageBuild() { + process.env[constants_1.Gatsby.Env] = "true"; + core.debug(`Set ${constants_1.Gatsby.Env}=${process.env[constants_1.Gatsby.Env]}`); } -exports.setBuildMode = setBuildMode; +exports.setConditionalPageBuild = setConditionalPageBuild; async function getBuildOutputPaths() { const targetPaths = [constants_1.Gatsby.CacheDir, constants_1.Gatsby.PublicDir]; const buildOutputPaths = []; diff --git a/dist/save/index.js b/dist/save/index.js index 414d577..f053cde 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -63290,7 +63290,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getBuildOutputPaths = exports.setBuildMode = exports.isCacheFeatureAvailable = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0; +exports.getBuildOutputPaths = exports.setConditionalPageBuild = exports.isCacheFeatureAvailable = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0; const cache = __importStar(__nccwpck_require__(7799)); const core = __importStar(__nccwpck_require__(2186)); const path_1 = __importDefault(__nccwpck_require__(1017)); @@ -63338,10 +63338,11 @@ Otherwise please upgrade to GHES version >= 3.5 and If you are also using Github return false; } exports.isCacheFeatureAvailable = isCacheFeatureAvailable; -function setBuildMode(useCache) { - process.env[constants_1.Gatsby.Env] = String(useCache); +function setConditionalPageBuild() { + process.env[constants_1.Gatsby.Env] = "true"; + core.debug(`Set ${constants_1.Gatsby.Env}=${process.env[constants_1.Gatsby.Env]}`); } -exports.setBuildMode = setBuildMode; +exports.setConditionalPageBuild = setConditionalPageBuild; async function getBuildOutputPaths() { const targetPaths = [constants_1.Gatsby.CacheDir, constants_1.Gatsby.PublicDir]; const buildOutputPaths = []; diff --git a/src/restoreImpl.ts b/src/restoreImpl.ts index 6b28f25..4d86da4 100644 --- a/src/restoreImpl.ts +++ b/src/restoreImpl.ts @@ -23,8 +23,7 @@ async function restoreImpl( return; } - const useCache: boolean = core.getBooleanInput(Inputs.UseCache); - utils.setBuildMode(useCache); + utils.setConditionalPageBuild(); const cachePaths: string[] = await utils.getBuildOutputPaths(); const restoreKeys: string[] = utils.getInputAsArray(Inputs.RestoreKeys); diff --git a/src/utils/actionUtils.ts b/src/utils/actionUtils.ts index 474efb0..8e8d07c 100644 --- a/src/utils/actionUtils.ts +++ b/src/utils/actionUtils.ts @@ -57,8 +57,9 @@ Otherwise please upgrade to GHES version >= 3.5 and If you are also using Github return false; } -export function setBuildMode(useCache: boolean): void { - process.env[Gatsby.Env] = String(useCache); +export function setConditionalPageBuild(): void { + process.env[Gatsby.Env] = "true"; + core.debug(`Set ${Gatsby.Env}=${process.env[Gatsby.Env]}`); } export async function getBuildOutputPaths(): Promise {