File tree Expand file tree Collapse file tree 4 files changed +9
-24
lines changed Expand file tree Collapse file tree 4 files changed +9
-24
lines changed Original file line number Diff line number Diff line change @@ -37234,18 +37234,17 @@ class CacheDistributor {
37234
37234
core.saveState(State.CACHE_PATHS, cachePath);
37235
37235
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
37236
37236
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
37237
- this.handleMatchResult(matchedKey);
37237
+ this.handleMatchResult(matchedKey, primaryKey );
37238
37238
});
37239
37239
}
37240
- handleMatchResult(matchedKey) {
37241
- if (matchedKey) {
37240
+ handleMatchResult(matchedKey, primaryKey ) {
37241
+ if (matchedKey == primaryKey ) {
37242
37242
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
37243
37243
core.info(`Cache restored from key: ${matchedKey}`);
37244
37244
}
37245
37245
else {
37246
37246
core.info(`${this.packageManager} cache is not found`);
37247
37247
}
37248
- core.info('cache was hit');
37249
37248
core.setOutput('cache-hit', Boolean(matchedKey));
37250
37249
}
37251
37250
}
Original file line number Diff line number Diff line change @@ -42579,18 +42579,17 @@ class CacheDistributor {
42579
42579
core.saveState(State.CACHE_PATHS, cachePath);
42580
42580
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
42581
42581
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
42582
- this.handleMatchResult(matchedKey);
42582
+ this.handleMatchResult(matchedKey, primaryKey );
42583
42583
});
42584
42584
}
42585
- handleMatchResult(matchedKey) {
42586
- if (matchedKey) {
42585
+ handleMatchResult(matchedKey, primaryKey ) {
42586
+ if (matchedKey == primaryKey ) {
42587
42587
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
42588
42588
core.info(`Cache restored from key: ${matchedKey}`);
42589
42589
}
42590
42590
else {
42591
42591
core.info(`${this.packageManager} cache is not found`);
42592
42592
}
42593
- core.info('cache was hit');
42594
42593
core.setOutput('cache-hit', Boolean(matchedKey));
42595
42594
}
42596
42595
}
Original file line number Diff line number Diff line change 1
1
import * as cache from '@actions/cache' ;
2
2
import * as core from '@actions/core' ;
3
- import { PromiseReturnType } from '../utils' ;
4
3
5
4
export enum State {
6
5
STATE_CACHE_PRIMARY_KEY = 'cache-primary-key' ,
@@ -42,19 +41,16 @@ abstract class CacheDistributor {
42
41
restoreKey
43
42
) ;
44
43
45
- this . handleMatchResult ( matchedKey ) ;
44
+ this . handleMatchResult ( matchedKey , primaryKey ) ;
46
45
}
47
46
48
- public handleMatchResult (
49
- matchedKey : PromiseReturnType < typeof cache . restoreCache >
50
- ) {
51
- if ( matchedKey ) {
47
+ public handleMatchResult ( matchedKey : string | undefined , primaryKey : string ) {
48
+ if ( matchedKey == primaryKey ) {
52
49
core . saveState ( State . CACHE_MATCHED_KEY , matchedKey ) ;
53
50
core . info ( `Cache restored from key: ${ matchedKey } ` ) ;
54
51
} else {
55
52
core . info ( `${ this . packageManager } cache is not found` ) ;
56
53
}
57
- core . info ( 'cache was hit' ) ;
58
54
core . setOutput ( 'cache-hit' , Boolean ( matchedKey ) ) ;
59
55
}
60
56
}
Original file line number Diff line number Diff line change @@ -119,12 +119,3 @@ export function isCacheFeatureAvailable(): boolean {
119
119
120
120
return true ;
121
121
}
122
-
123
- // Awaited (typescript 4.5+) polyfill. Not ideal, so use with care
124
- export type AwaitedPolyfill < T > = T extends PromiseLike < infer U >
125
- ? AwaitedPolyfill < U >
126
- : T ;
127
- // Extract return type from promise
128
- export type PromiseReturnType <
129
- T extends ( ...args : any ) => any
130
- > = AwaitedPolyfill < ReturnType < T > > ;
You can’t perform that action at this time.
0 commit comments