Skip to content
Snippets Groups Projects
Unverified Commit 1391570e authored by Sigurd Spieckermann's avatar Sigurd Spieckermann Committed by GitHub
Browse files

fix(validator): use absolute path for all `.js` configs (#27139)

parent f3be8d96
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,9 @@ export async function getParsedContent(file: string): Promise<RenovateConfig> { ...@@ -27,7 +27,9 @@ export async function getParsedContent(file: string): Promise<RenovateConfig> {
) as RenovateConfig; ) as RenovateConfig;
case '.cjs': case '.cjs':
case '.js': { case '.js': {
const tmpConfig = await import(file); const tmpConfig = await import(
upath.isAbsolute(file) ? file : `${process.cwd()}/${file}`
);
let config = tmpConfig.default let config = tmpConfig.default
? tmpConfig.default ? tmpConfig.default
: /* istanbul ignore next: hard to test */ tmpConfig; : /* istanbul ignore next: hard to test */ tmpConfig;
...@@ -43,10 +45,7 @@ export async function getParsedContent(file: string): Promise<RenovateConfig> { ...@@ -43,10 +45,7 @@ export async function getParsedContent(file: string): Promise<RenovateConfig> {
} }
export async function getConfig(env: NodeJS.ProcessEnv): Promise<AllConfig> { export async function getConfig(env: NodeJS.ProcessEnv): Promise<AllConfig> {
let configFile = env.RENOVATE_CONFIG_FILE ?? 'config.js'; const configFile = env.RENOVATE_CONFIG_FILE ?? 'config.js';
if (!upath.isAbsolute(configFile)) {
configFile = `${process.cwd()}/${configFile}`;
}
if (env.RENOVATE_CONFIG_FILE && !(await fs.pathExists(configFile))) { if (env.RENOVATE_CONFIG_FILE && !(await fs.pathExists(configFile))) {
logger.fatal( logger.fatal(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment