From dd4200ae252e06b0e5e757ccbe778a575d113510 Mon Sep 17 00:00:00 2001 From: Shunsuke Suzuki <suzuki-shunsuke@users.noreply.github.com> Date: Fri, 25 Aug 2023 17:16:30 +0900 Subject: [PATCH] fix(renovate-config-validator): support .renovaterc (#22991) --- lib/workers/global/config/parse/__fixtures__/.renovaterc | 5 +++++ lib/workers/global/config/parse/file.spec.ts | 1 + lib/workers/global/config/parse/file.ts | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 lib/workers/global/config/parse/__fixtures__/.renovaterc diff --git a/lib/workers/global/config/parse/__fixtures__/.renovaterc b/lib/workers/global/config/parse/__fixtures__/.renovaterc new file mode 100644 index 0000000000..d5c5a80390 --- /dev/null +++ b/lib/workers/global/config/parse/__fixtures__/.renovaterc @@ -0,0 +1,5 @@ +{ + // Renovate parses all configuration files as JSON5. + // https://github.com/renovatebot/renovate/pull/22991#issuecomment-1609106254 + token: "abcdefg", +} diff --git a/lib/workers/global/config/parse/file.spec.ts b/lib/workers/global/config/parse/file.spec.ts index c1e2038c9c..3b7d22e340 100644 --- a/lib/workers/global/config/parse/file.spec.ts +++ b/lib/workers/global/config/parse/file.spec.ts @@ -35,6 +35,7 @@ describe('workers/global/config/parse/file', () => { 'custom js config file exporting an async function', 'config-async-function.js', ], + ['.renovaterc', '.renovaterc'], ['JSON5 config file', 'config.json5'], ['YAML config file', 'config.yaml'], ])('parses %s', async (fileType, filePath) => { diff --git a/lib/workers/global/config/parse/file.ts b/lib/workers/global/config/parse/file.ts index 5a66827ace..eeeaf5671e 100644 --- a/lib/workers/global/config/parse/file.ts +++ b/lib/workers/global/config/parse/file.ts @@ -9,6 +9,9 @@ import { logger } from '../../../../logger'; import { readSystemFile } from '../../../../util/fs'; export async function getParsedContent(file: string): Promise<RenovateConfig> { + if (upath.basename(file) === '.renovaterc') { + return JSON5.parse(await readSystemFile(file, 'utf8')); + } switch (upath.extname(file)) { case '.yaml': case '.yml': -- GitLab