Skip to content

Commit

Permalink
fix: messages about keys
Browse files Browse the repository at this point in the history
  • Loading branch information
deemp committed Dec 5, 2023
1 parent 4236c47 commit 463822b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/restoreImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { IStateProvider } from "./stateProvider";
import * as utils from "./utils/actionUtils";

export async function restoreWithKey(key: string, paths: string[]) {
utils.info(`Restoring a cache with the key "${key}"...`);
utils.info(`Restoring a cache with the key "${key}".`);

utils.info(
`::group::Logs while restoring. Errors are due to attempts to overwrite read-only paths.`
Expand All @@ -21,7 +21,7 @@ export async function restoreWithKey(key: string, paths: string[]) {

utils.info(`::endgroup::`);

utils.info(`Finished restoring a cache with the key "${key}"...`);
utils.info(`Finished restoring a cache with the key "${key}".`);
}

async function restoreImpl(
Expand Down Expand Up @@ -50,7 +50,7 @@ async function restoreImpl(
const failOnCacheMiss = utils.getInputAsBool(Inputs.FailOnCacheMiss);
const restoreKeyHit = utils.getInputAsBool(Inputs.RestoreKeyHit);

utils.info(`Searching for a cache with the key "${primaryKey}"...`);
utils.info(`Searching for a cache with the key "${primaryKey}".`);

let cacheKey = await utils.getCacheKey({
paths: cachePaths,
Expand All @@ -64,7 +64,7 @@ async function restoreImpl(
} else {
utils.info(
`
No cache with the key "${cacheKey}" found.
No cache with the given primary key found.
Searching for a cache using restore keys:
${JSON.stringify(restoreKeys)}
`
Expand Down Expand Up @@ -92,7 +92,7 @@ async function restoreImpl(
`
Failed to restore cache entry.
Exiting as fail-on-cache-miss is set.
Input key: ${primaryKey}
Input key: "${primaryKey}"
`
);
}
Expand All @@ -119,7 +119,7 @@ async function restoreImpl(

core.setOutput(Outputs.CacheHit, isExactKeyMatch.toString());

utils.info(`Cache restored from key: ${cacheKey}`);
utils.info(`Cache restored from key: "${cacheKey}"`);

await restoreExtraCaches();

Expand Down
12 changes: 7 additions & 5 deletions src/saveImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ async function saveImpl(stateProvider: IStateProvider): Promise<number | void> {
const time = Date.now();

if (utils.isExactKeyMatch(primaryKey, restoredKey)) {
utils.info(`Cache hit occurred on the primary key ${primaryKey}.`);
utils.info(
`Cache hit occurred on the primary key "${primaryKey}".`
);

const caches = await purgeCaches({
key: primaryKey,
Expand All @@ -67,7 +69,7 @@ async function saveImpl(stateProvider: IStateProvider): Promise<number | void> {
});

if (caches.map(cache => cache.key).includes(primaryKey)) {
utils.info(`Purging the cache with the key ${primaryKey}...`);
utils.info(`Purging the cache with the key "${primaryKey}".`);

const token = core.getInput(Inputs.Token, { required: true });
const octokit = getOctokit(token);
Expand All @@ -81,7 +83,7 @@ async function saveImpl(stateProvider: IStateProvider): Promise<number | void> {
});
} else {
utils.info(
`The cache with the key ${primaryKey} won't be purged. Not saving a new cache.`
`The cache with the key "${primaryKey}" won't be purged. Not saving a new cache.`
);

await purgeCaches({ key: primaryKey, lookupOnly: false, time });
Expand All @@ -92,14 +94,14 @@ async function saveImpl(stateProvider: IStateProvider): Promise<number | void> {

await collectGarbage();

utils.info(`Saving a new cache with the key ${primaryKey}...`);
utils.info(`Saving a new cache with the key "${primaryKey}".`);

cacheId = await cache.saveCache(cachePaths, primaryKey, {
uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)
});

if (cacheId != -1) {
utils.info(`Cache saved with the key ${primaryKey}.`);
utils.info(`Cache saved with the key "${primaryKey}".`);

await purgeCaches({ key: primaryKey, lookupOnly: false, time });
}
Expand Down

0 comments on commit 463822b

Please sign in to comment.