mirror of
https://gitea.com/actions/setup-node.git
synced 2026-01-02 16:14:06 +08:00
handle non-dir cache-dependency-path
This commit is contained in:
@@ -2,6 +2,7 @@ import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as cache from '@actions/cache';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
type SupportedPackageManagers = {
|
||||
[prop: string]: PackageManagerInfo;
|
||||
@@ -58,7 +59,17 @@ export const getPackageManagerWorkingDir = (): string | null => {
|
||||
}
|
||||
|
||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||
return cacheDependencyPath ? path.dirname(cacheDependencyPath) : null;
|
||||
if (!cacheDependencyPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const wd = path.dirname(cacheDependencyPath);
|
||||
|
||||
if (fs.existsSync(wd) && fs.lstatSync(wd).isDirectory()) {
|
||||
return wd;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export const getPackageManagerCommandOutput = (command: string) =>
|
||||
|
||||
Reference in New Issue
Block a user