Skip to content

Commit 15457da

Browse files
authored
Don't append - when append-timestamp is disabled. (#306)
1 parent 25d49ca commit 15457da

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/restore.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ async function restore(ccacheVariant : string) : Promise<void> {
1717
const inputs = {
1818
primaryKey: core.getInput("key"),
1919
// https://github.com/actions/cache/blob/73cb7e04054996a98d39095c0b7821a73fb5b3ea/src/utils/actionUtils.ts#L56
20-
restoreKeys: core.getInput("restore-keys").split("\n").map(s => s.trim()).filter(x => x !== "")
20+
restoreKeys: core.getInput("restore-keys").split("\n").map(s => s.trim()).filter(x => x !== ""),
21+
appendTimestamp: core.getInput("append-timestamp")
2122
};
2223

2324
const keyPrefix = ccacheVariant + "-";
24-
const primaryKey = inputs.primaryKey ? keyPrefix + inputs.primaryKey + "-" : keyPrefix;
25-
const restoreKeys = inputs.restoreKeys.map(k => keyPrefix + k + "-")
25+
const primaryKey = inputs.primaryKey ? keyPrefix + (inputs.appendTimestamp ? inputs.primaryKey + "-" : inputs.primaryKey) : keyPrefix;
26+
const restoreKeys = inputs.restoreKeys.map(k => keyPrefix + k + (inputs.appendTimestamp ? "-" : ""));
2627
const paths = [cacheDir(ccacheVariant)];
2728

2829
core.saveState("primaryKey", primaryKey);

0 commit comments

Comments
 (0)