From 8644d4cc22edbf6028802115c985185261728d50 Mon Sep 17 00:00:00 2001 From: Evgenii Korolevskii Date: Fri, 20 Jan 2023 01:50:06 +0100 Subject: [PATCH] add backup --- dist/setup/index.js | 6 ++++-- src/cache-distributions/pip-cache.ts | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 0eda8334..4a3c0dd4 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65908,6 +65908,7 @@ class PipCache extends cache_distributor_1.default { constructor(pythonVersion, cacheDependencyPath = '**/requirements.txt') { super('pip', cacheDependencyPath); this.pythonVersion = pythonVersion; + this.cacheDependencyBackupPath = '**/pyproject.toml'; } getCacheGlobalDirectories() { return __awaiter(this, void 0, void 0, function* () { @@ -65943,8 +65944,9 @@ class PipCache extends cache_distributor_1.default { } computeKeys() { return __awaiter(this, void 0, void 0, function* () { - const hash = yield glob.hashFiles(this.cacheDependencyPath); - core.info(`Cache key hash: ${hash}, path: ${this.cacheDependencyPath}`); + const hash = (yield glob.hashFiles(this.cacheDependencyPath)) + || (yield glob.hashFiles(this.cacheDependencyBackupPath)); + core.info(`Cache key hash: ${hash}`); let primaryKey = ''; let restoreKey = ''; if (utils_1.IS_LINUX) { diff --git a/src/cache-distributions/pip-cache.ts b/src/cache-distributions/pip-cache.ts index aedd3e0d..e8666033 100644 --- a/src/cache-distributions/pip-cache.ts +++ b/src/cache-distributions/pip-cache.ts @@ -10,6 +10,9 @@ import CacheDistributor from './cache-distributor'; import {getLinuxInfo, IS_LINUX, IS_WINDOWS} from '../utils'; class PipCache extends CacheDistributor { + + private readonly cacheDependencyBackupPath: string = '**/pyproject.toml'; + constructor( private pythonVersion: string, cacheDependencyPath: string = '**/requirements.txt' @@ -56,8 +59,9 @@ class PipCache extends CacheDistributor { } protected async computeKeys() { - const hash = await glob.hashFiles(this.cacheDependencyPath); - core.info(`Cache key hash: ${hash}, path: ${this.cacheDependencyPath}`); + const hash = await glob.hashFiles(this.cacheDependencyPath) + || await glob.hashFiles(this.cacheDependencyBackupPath); + core.info(`Cache key hash: ${hash}`); let primaryKey = ''; let restoreKey = '';