mirror of
https://github.com/docker/build-push-action.git
synced 2025-06-19 17:27:12 +02:00
Test GitHub Cache
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
26
src/state-helper.ts
Normal file
26
src/state-helper.ts
Normal 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');
|
||||
}
|
Reference in New Issue
Block a user