mirror of
https://github.com/actions/setup-node.git
synced 2025-05-11 19:53:43 +00:00
handle non-dir cache-dependency-path
This commit is contained in:
parent
813556063c
commit
a3d2aaf78f
5 changed files with 118 additions and 61 deletions
12
dist/setup/index.js
vendored
12
dist/setup/index.js
vendored
|
@ -71167,7 +71167,7 @@ const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0,
|
|||
exports.restoreCache = restoreCache;
|
||||
const findLockFile = (packageManager) => {
|
||||
const lockFiles = packageManager.lockFilePatterns;
|
||||
const workspace = cache_utils_1.getPackageManagerWorkingDir() || process.env.GITHUB_WORKSPACE;
|
||||
const workspace = process.env.GITHUB_WORKSPACE;
|
||||
const rootContent = fs_1.default.readdirSync(workspace);
|
||||
const lockFile = lockFiles.find(item => rootContent.includes(item));
|
||||
if (!lockFile) {
|
||||
|
@ -71221,6 +71221,7 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
exports.supportedPackageManagers = {
|
||||
npm: {
|
||||
lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
|
||||
|
@ -71256,7 +71257,14 @@ const getPackageManagerWorkingDir = () => {
|
|||
return null;
|
||||
}
|
||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||
return cacheDependencyPath ? path_1.default.dirname(cacheDependencyPath) : null;
|
||||
if (!cacheDependencyPath) {
|
||||
return null;
|
||||
}
|
||||
const wd = path_1.default.dirname(cacheDependencyPath);
|
||||
if (fs_1.default.existsSync(wd) && fs_1.default.lstatSync(wd).isDirectory()) {
|
||||
return wd;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
exports.getPackageManagerWorkingDir = getPackageManagerWorkingDir;
|
||||
const getPackageManagerCommandOutput = (command) => exports.getCommandOutput(command, exports.getPackageManagerWorkingDir());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue