mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-06-07 20:51:11 +00:00
Fix find lock file
This commit is contained in:
parent
318f863611
commit
086599f868
4 changed files with 13 additions and 9 deletions
|
@ -8,6 +8,7 @@ import {State} from './constants';
|
|||
import {
|
||||
getCacheDirectoryPath,
|
||||
getPackageManagerInfo,
|
||||
getPackageManagerWorkingDir,
|
||||
PackageManagerInfo
|
||||
} from './cache-utils';
|
||||
|
||||
|
@ -55,7 +56,8 @@ export const restoreCache = async (
|
|||
|
||||
const findLockFile = (packageManager: PackageManagerInfo) => {
|
||||
const lockFiles = packageManager.lockFilePatterns;
|
||||
const workspace = process.env.GITHUB_WORKSPACE!;
|
||||
const workspace =
|
||||
getPackageManagerWorkingDir() || process.env.GITHUB_WORKSPACE!;
|
||||
const rootContent = fs.readdirSync(workspace);
|
||||
|
||||
const lockFile = lockFiles.find(item => rootContent.includes(item));
|
||||
|
|
|
@ -51,7 +51,7 @@ export const getCommandOutput = async (
|
|||
return stdout.trim();
|
||||
};
|
||||
|
||||
const getPackageManagerWorkingDir = (): string | null => {
|
||||
export const getPackageManagerWorkingDir = (): string | null => {
|
||||
const projectDir = core.getInput('project-dir');
|
||||
if (projectDir) {
|
||||
return projectDir;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue