mirror of
https://github.com/actions/setup-node.git
synced 2025-06-30 06:33:48 +00:00
Use cache prefix if all sub-projects are yarn managed
This commit is contained in:
parent
342f9b87ab
commit
62a8f25abf
4 changed files with 27 additions and 33 deletions
17
dist/cache-save/index.js
vendored
17
dist/cache-save/index.js
vendored
|
@ -60604,23 +60604,20 @@ const isCacheManagedByYarn3 = (directory) => __awaiter(void 0, void 0, void 0, f
|
|||
return enableGlobalCache === 'false';
|
||||
});
|
||||
/**
|
||||
* A function to report either the repo contains at least one Yarn managed directory
|
||||
* A function to report the repo contains Yarn managed projects
|
||||
* @param packageManagerInfo - used to make sure current package manager is yarn
|
||||
* @return - true if there's at least one Yarn managed directory in the repo
|
||||
* @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
|
||||
* expected to be the result of `core.getInput('cache-dependency-path')`
|
||||
* @return - true if all project directories configured to be Yarn managed
|
||||
*/
|
||||
const repoHasYarn3ManagedCache = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const repoHasYarn3ManagedCache = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
if (packageManagerInfo.name !== 'yarn')
|
||||
return false;
|
||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||
const yarnDirs = cacheDependencyPath
|
||||
? yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath)
|
||||
: [''];
|
||||
for (const dir of yarnDirs.length === 0 ? [''] : yarnDirs) {
|
||||
if (yield isCacheManagedByYarn3(dir)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
const isManagedList = yield Promise.all(yarnDirs.map(isCacheManagedByYarn3));
|
||||
return isManagedList.every(Boolean);
|
||||
});
|
||||
exports.repoHasYarn3ManagedCache = repoHasYarn3ManagedCache;
|
||||
function isGhes() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue