Fix cache restoreKeys

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2020-08-16 23:01:53 +02:00
parent bd7ed33c45
commit 6ede7e932d
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
3 changed files with 68 additions and 404 deletions

View file

@ -1,6 +1,5 @@
import * as os from 'os';
import * as path from 'path';
import md5 from 'md5';
import {Inputs} from './context';
import * as stateHelper from './state-helper';
import * as cache from '@actions/cache';
@ -13,11 +12,11 @@ export async function restoreCache(inputs: Inputs): Promise<Inputs> {
return inputs;
}
const primaryKey = `${process.env.RUNNER_OS}-docker-build-push-${md5(inputs.context)}`;
const primaryKey = `${process.env.RUNNER_OS}-docker-build-push-${process.env.GITHUB_SHA}`;
stateHelper.setCachePrimaryKey(primaryKey);
try {
const cacheKey = await cache.restoreCache([cachePath], primaryKey);
const cacheKey = await cache.restoreCache([cachePath], primaryKey, [`${process.env.RUNNER_OS}-docker-build-push-`]);
if (!cacheKey) {
core.info(`GitHub Cache not found for key: ${primaryKey}`);