Skip to content

Commit

Permalink
Merge pull request #83 from jongwooo/feat/remove-use-cache-input
Browse files Browse the repository at this point in the history
feat: Remove use-cache input
  • Loading branch information
jongwooo authored Dec 26, 2022
2 parents eba3a0a + 7b2b112 commit 21627d5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 19 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 0 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: "Gatsby Cache"
description: "Cache build outputs for Gatsby's Conditional Page Build."
author: "jongwooo <jongwooo.han@gmail.com>"
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
Expand Down
12 changes: 6 additions & 6 deletions dist/restore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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 = [];
Expand Down
9 changes: 5 additions & 4 deletions dist/save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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 = [];
Expand Down
3 changes: 1 addition & 2 deletions src/restoreImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions src/utils/actionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string[]> {
Expand Down

0 comments on commit 21627d5

Please sign in to comment.