docker-build-push-action/src/state-helper.ts
CrazyMax 22acf7cb32
Test GitHub Cache
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2020-08-16 22:31:37 +02:00

27 lines
733 B
TypeScript

import * as core from '@actions/core';
export const IsPost = !!process.env['STATE_isPost'];
export const cachePrimaryKey = process.env['STATE_cachePrimaryKey'] || '';
export const cacheMatchedKey = process.env['STATE_cacheMatchedKey'] || '';
export function setCachePrimaryKey(cachePrimaryKey: string) {
core.saveState('cachePrimaryKey', cachePrimaryKey);
}
export function setCacheMatchedKey(cacheMatchedKey: string) {
core.saveState('cacheMatchedKey', cacheMatchedKey);
}
export function isExactKeyMatch(key: string, cacheKey?: string): boolean {
return !!(
cacheKey &&
cacheKey.localeCompare(key, undefined, {
sensitivity: 'accent'
}) === 0
);
}
if (!IsPost) {
core.saveState('isPost', 'true');
}