mirror of
https://github.com/actions/setup-python.git
synced 2026-01-21 13:48:54 +08:00
Remove PromiseReturnType, add matchedKey == primaryKey check
This commit is contained in:
parent
fa50ad5388
commit
08415fd28f
4 changed files with 9 additions and 24 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import {PromiseReturnType} from '../utils';
|
||||
|
||||
export enum State {
|
||||
STATE_CACHE_PRIMARY_KEY = 'cache-primary-key',
|
||||
|
|
@ -42,19 +41,16 @@ abstract class CacheDistributor {
|
|||
restoreKey
|
||||
);
|
||||
|
||||
this.handleMatchResult(matchedKey);
|
||||
this.handleMatchResult(matchedKey, primaryKey);
|
||||
}
|
||||
|
||||
public handleMatchResult(
|
||||
matchedKey: PromiseReturnType<typeof cache.restoreCache>
|
||||
) {
|
||||
if (matchedKey) {
|
||||
public handleMatchResult(matchedKey: string | undefined, primaryKey: string) {
|
||||
if (matchedKey == primaryKey) {
|
||||
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
||||
core.info(`Cache restored from key: ${matchedKey}`);
|
||||
} else {
|
||||
core.info(`${this.packageManager} cache is not found`);
|
||||
}
|
||||
core.info('cache was hit');
|
||||
core.setOutput('cache-hit', Boolean(matchedKey));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue