Test GitHub Cache

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2020-08-16 22:31:37 +02:00
parent 5003e0df3d
commit 22acf7cb32
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
10 changed files with 54626 additions and 51 deletions

26
src/state-helper.ts Normal file
View file

@ -0,0 +1,26 @@
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');
}