mirror of
https://github.com/docker/build-push-action.git
synced 2025-04-19 09:56:46 +00:00
Test GitHub Cache
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
5003e0df3d
commit
22acf7cb32
10 changed files with 54626 additions and 51 deletions
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');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue