mirror of
				https://github.com/actions/cache.git
				synced 2025-10-23 08:56:26 +08:00 
			
		
		
		
	update save as well
This commit is contained in:
		| @@ -1,7 +1,7 @@ | ||||
| import * as cache from "@actions/cache"; | ||||
| import * as core from "@actions/core"; | ||||
|  | ||||
| import { Outputs, RefKey, State } from "../constants"; | ||||
| import { Outputs, RefKey } from "../constants"; | ||||
|  | ||||
| export function isGhes(): boolean { | ||||
|     const ghUrl = new URL( | ||||
| @@ -19,30 +19,10 @@ export function isExactKeyMatch(key: string, cacheKey?: string): boolean { | ||||
|     ); | ||||
| } | ||||
|  | ||||
| export function setCacheState(state: string): void { | ||||
|     core.saveState(State.CacheMatchedKey, state); | ||||
| } | ||||
|  | ||||
| export function setCacheHitOutput(isCacheHit: boolean): void { | ||||
|     core.setOutput(Outputs.CacheHit, isCacheHit.toString()); | ||||
| } | ||||
|  | ||||
| export function setOutputAndState(key: string, cacheKey?: string): void { | ||||
|     setCacheHitOutput(isExactKeyMatch(key, cacheKey)); | ||||
|     // Store the matched cache key if it exists | ||||
|     cacheKey && setCacheState(cacheKey); | ||||
| } | ||||
|  | ||||
| export function getCacheState(): string | undefined { | ||||
|     const cacheKey = core.getState(State.CacheMatchedKey); | ||||
|     if (cacheKey) { | ||||
|         core.debug(`Cache state/key: ${cacheKey}`); | ||||
|         return cacheKey; | ||||
|     } | ||||
|  | ||||
|     return undefined; | ||||
| } | ||||
|  | ||||
| export function logWarning(message: string): void { | ||||
|     const warningPrefix = "[warning]"; | ||||
|     core.info(`${warningPrefix}${message}`); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user