3
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-04-23 03:45:31 +00:00

Fix save-always/post-if with an output

This commit is contained in:
Danny Gleckler 2024-02-08 20:07:45 -05:00
parent 0c45773b62
commit 7214f3c546
6 changed files with 65 additions and 16 deletions

View file

@ -5,13 +5,15 @@ export enum Inputs {
UploadChunkSize = "upload-chunk-size", // Input for cache, save action
EnableCrossOsArchive = "enableCrossOsArchive", // Input for cache, restore, save action
FailOnCacheMiss = "fail-on-cache-miss", // Input for cache, restore action
LookupOnly = "lookup-only" // Input for cache, restore action
LookupOnly = "lookup-only", // Input for cache, restore action
SaveAlways = "save-always" // Input for cache action
}
export enum Outputs {
CacheHit = "cache-hit", // Output from cache, restore action
CachePrimaryKey = "cache-primary-key", // Output from restore action
CacheMatchedKey = "cache-matched-key" // Output from restore action
CacheMatchedKey = "cache-matched-key", // Output from restore action
SaveAlways = "save-always-d18d746b9" // Output from cache action, with unique suffix for detection in post-if
}
export enum State {

View file

@ -13,6 +13,8 @@ export async function restoreImpl(
stateProvider: IStateProvider,
earlyExit?: boolean | undefined
): Promise<string | undefined> {
core.setOutput(Outputs.SaveAlways, core.getInput(Inputs.SaveAlways));
try {
if (!utils.isCacheFeatureAvailable()) {
core.setOutput(Outputs.CacheHit, "false");