mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-20 15:53:59 +08:00
React to feeback and change to use 0.2.0 cache package
This commit is contained in:
parent
249a22026d
commit
bcc23b930f
10 changed files with 5098 additions and 5604 deletions
|
@ -12,7 +12,7 @@ export function isExactKeyMatch(key: string, cacheKey?: string): boolean {
|
|||
}
|
||||
|
||||
export function setCacheState(state: string): void {
|
||||
core.saveState(State.CacheResult, state);
|
||||
core.saveState(State.CacheMatchedKey, state);
|
||||
}
|
||||
|
||||
export function setCacheHitOutput(isCacheHit: boolean): void {
|
||||
|
@ -21,12 +21,12 @@ export function setCacheHitOutput(isCacheHit: boolean): void {
|
|||
|
||||
export function setOutputAndState(key: string, cacheKey?: string): void {
|
||||
setCacheHitOutput(isExactKeyMatch(key, cacheKey));
|
||||
// Store the cache result if it exists
|
||||
// Store the matched cache key if it exists
|
||||
cacheKey && setCacheState(cacheKey);
|
||||
}
|
||||
|
||||
export function getCacheState(): string | undefined {
|
||||
const cacheKey = core.getState(State.CacheResult);
|
||||
const cacheKey = core.getState(State.CacheMatchedKey);
|
||||
if (cacheKey) {
|
||||
core.debug(`Cache state/key: ${cacheKey}`);
|
||||
return cacheKey;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue