diff --git a/lib/platform/azure/index.spec.ts b/lib/platform/azure/index.spec.ts index 38e0c7e3db9590db0bc22952ed413fdb69d92e7a..d58329075a9491182a42d113dfee274cc48404ef 100644 --- a/lib/platform/azure/index.spec.ts +++ b/lib/platform/azure/index.spec.ts @@ -1196,7 +1196,7 @@ describe('platform/azure', () => { const res = await azure.getJsonFile('file.json'); expect(res).toEqual(data); }); - it('returns null for malformed JSON', async () => { + it('throws on malformed JSON', async () => { azureApi.gitApi.mockImplementationOnce( () => ({ @@ -1205,18 +1205,18 @@ describe('platform/azure', () => { ), } as any) ); - const res = await azure.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(azure.getJsonFile('file.json')).rejects.toThrow(); }); - it('returns null on errors', async () => { + it('throws on errors', async () => { azureApi.gitApi.mockImplementationOnce( () => ({ - getItemContent: jest.fn(() => Promise.reject('some error')), + getItemContent: jest.fn(() => { + throw new Error('some error'); + }), } as any) ); - const res = await azure.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(azure.getJsonFile('file.json')).rejects.toThrow(); }); }); }); diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts index d22d788aa36ce6097b80440c160f7cb026417cc8..f229ae5bed18efdb45c82275eb0c9c15087db742 100644 --- a/lib/platform/azure/index.ts +++ b/lib/platform/azure/index.ts @@ -108,26 +108,18 @@ export async function getRawFile( fileName: string, repo: string = config.repoId ): Promise<string | null> { - try { - const azureApiGit = await azureApi.gitApi(); - const buf = await azureApiGit.getItemContent(repo, fileName); - const str = await streamToString(buf); - return str; - } catch (err) { - return null; - } + const azureApiGit = await azureApi.gitApi(); + const buf = await azureApiGit.getItemContent(repo, fileName); + const str = await streamToString(buf); + return str; } export async function getJsonFile( fileName: string, repo: string = config.repoId ): Promise<any | null> { - try { - const raw = await getRawFile(fileName, repo); - return raw && JSON.parse(raw); - } catch (err) { - return null; - } + const raw = await getRawFile(fileName, repo); + return JSON.parse(raw); } export async function initRepo({ diff --git a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap index 25a868a27f971f32487a84f71d1948d5b1656736..11d930e5352015db334b6efa37e40204985d8d51 100644 --- a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap +++ b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap @@ -1931,7 +1931,7 @@ Array [ ] `; -exports[`platform/bitbucket-server/index endpoint with no path getJsonFile() returns null for long content 1`] = ` +exports[`platform/bitbucket-server/index endpoint with no path getJsonFile() throws on errors 1`] = ` Array [ Object { "headers": Object { @@ -1972,7 +1972,7 @@ Array [ ] `; -exports[`platform/bitbucket-server/index endpoint with no path getJsonFile() returns null for malformed JSON 1`] = ` +exports[`platform/bitbucket-server/index endpoint with no path getJsonFile() throws on long content 1`] = ` Array [ Object { "headers": Object { @@ -2013,7 +2013,7 @@ Array [ ] `; -exports[`platform/bitbucket-server/index endpoint with no path getJsonFile() returns null on errors 1`] = ` +exports[`platform/bitbucket-server/index endpoint with no path getJsonFile() throws on malformed JSON 1`] = ` Array [ Object { "headers": Object { @@ -6062,7 +6062,7 @@ Array [ ] `; -exports[`platform/bitbucket-server/index endpoint with path getJsonFile() returns null for long content 1`] = ` +exports[`platform/bitbucket-server/index endpoint with path getJsonFile() throws on errors 1`] = ` Array [ Object { "headers": Object { @@ -6103,7 +6103,7 @@ Array [ ] `; -exports[`platform/bitbucket-server/index endpoint with path getJsonFile() returns null for malformed JSON 1`] = ` +exports[`platform/bitbucket-server/index endpoint with path getJsonFile() throws on long content 1`] = ` Array [ Object { "headers": Object { @@ -6144,7 +6144,7 @@ Array [ ] `; -exports[`platform/bitbucket-server/index endpoint with path getJsonFile() returns null on errors 1`] = ` +exports[`platform/bitbucket-server/index endpoint with path getJsonFile() throws on malformed JSON 1`] = ` Array [ Object { "headers": Object { diff --git a/lib/platform/bitbucket-server/index.spec.ts b/lib/platform/bitbucket-server/index.spec.ts index 6e06889f121917906ffae8a0ba01e805837ce96b..6a06f89c81b01873eda86e1b43199ed849b17356 100644 --- a/lib/platform/bitbucket-server/index.spec.ts +++ b/lib/platform/bitbucket-server/index.spec.ts @@ -2107,7 +2107,7 @@ Followed by some information. expect(res).toEqual(data); expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('returns null for malformed JSON', async () => { + it('throws on malformed JSON', async () => { const scope = await initRepo(); scope .get( @@ -2117,11 +2117,10 @@ Followed by some information. isLastPage: true, lines: [{ text: '!@#' }], }); - const res = await bitbucket.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(bitbucket.getJsonFile('file.json')).rejects.toThrow(); expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('returns null for long content', async () => { + it('throws on long content', async () => { const scope = await initRepo(); scope .get( @@ -2131,19 +2130,17 @@ Followed by some information. isLastPage: false, lines: [{ text: '{' }], }); - const res = await bitbucket.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(bitbucket.getJsonFile('file.json')).rejects.toThrow(); expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('returns null on errors', async () => { + it('throws on errors', async () => { const scope = await initRepo(); scope .get( `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/browse/file.json?limit=20000` ) .replyWithError('some error'); - const res = await bitbucket.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(bitbucket.getJsonFile('file.json')).rejects.toThrow(); expect(httpMock.getTrace()).toMatchSnapshot(); }); }); diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts index aba7cd62846093a9e71c868a76f65a38fd6795f1..95423d626bcc883a5a3ee4171f073257807f0f68 100644 --- a/lib/platform/bitbucket-server/index.ts +++ b/lib/platform/bitbucket-server/index.ts @@ -122,31 +122,24 @@ export async function getRawFile( fileName: string, repo: string = config.repository ): Promise<string | null> { - try { - const [project, slug] = repo.split('/'); - const fileUrl = `./rest/api/1.0/projects/${project}/repos/${slug}/browse/${fileName}?limit=20000`; - const res = await bitbucketServerHttp.getJson<FileData>(fileUrl); - const { isLastPage, lines, size } = res.body; - if (isLastPage) { - return lines.map(({ text }) => text).join(''); - } - logger.warn({ size }, `The file is too big`); - } catch (err) { - // no-op + const [project, slug] = repo.split('/'); + const fileUrl = `./rest/api/1.0/projects/${project}/repos/${slug}/browse/${fileName}?limit=20000`; + const res = await bitbucketServerHttp.getJson<FileData>(fileUrl); + const { isLastPage, lines, size } = res.body; + if (isLastPage) { + return lines.map(({ text }) => text).join(''); } - return null; + const msg = `The file is too big (${size}B)`; + logger.warn({ size }, msg); + throw new Error(msg); } export async function getJsonFile( fileName: string, repo: string = config.repository ): Promise<any | null> { - try { - const raw = await getRawFile(fileName, repo); - return raw && JSON.parse(raw); - } catch (err) { - return null; - } + const raw = await getRawFile(fileName, repo); + return JSON.parse(raw); } // Initialize BitBucket Server by getting base branch diff --git a/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap b/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap index e368a8d464fc61d44c83f6bb6c4248b6d17bd635..c7ee7e74d2f99022709887c45ac9b64393623273 100644 --- a/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap +++ b/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap @@ -921,7 +921,7 @@ Array [ ] `; -exports[`platform/bitbucket getJsonFile() returns null for malformed JSON 1`] = ` +exports[`platform/bitbucket getJsonFile() throws on errors 1`] = ` Array [ Object { "headers": Object { @@ -947,7 +947,7 @@ Array [ ] `; -exports[`platform/bitbucket getJsonFile() returns null on errors 1`] = ` +exports[`platform/bitbucket getJsonFile() throws on malformed JSON 1`] = ` Array [ Object { "headers": Object { diff --git a/lib/platform/bitbucket/index.spec.ts b/lib/platform/bitbucket/index.spec.ts index ab296ce6c03a87f9d9db039937f3a3e8a82ded00..1df73fffd706baaecac0f6d3c615c1406eacf234 100644 --- a/lib/platform/bitbucket/index.spec.ts +++ b/lib/platform/bitbucket/index.spec.ts @@ -851,22 +851,20 @@ describe('platform/bitbucket', () => { expect(res).toEqual(data); expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('returns null for malformed JSON', async () => { + it('throws on malformed JSON', async () => { const scope = await initRepoMock(); scope .get('/2.0/repositories/some/repo/src/HEAD/file.json') .reply(200, '!@#'); - const res = await bitbucket.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(bitbucket.getJsonFile('file.json')).rejects.toThrow(); expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('returns null on errors', async () => { + it('throws on errors', async () => { const scope = await initRepoMock(); scope .get('/2.0/repositories/some/repo/src/HEAD/file.json') .replyWithError('some error'); - const res = await bitbucket.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(bitbucket.getJsonFile('file.json')).rejects.toThrow(); expect(httpMock.getTrace()).toMatchSnapshot(); }); }); diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts index 709852540c7233ef97956ec8806b24a8eefc06ba..4862efafd4a76e95861dc016938d243b70e34e7d 100644 --- a/lib/platform/bitbucket/index.ts +++ b/lib/platform/bitbucket/index.ts @@ -103,27 +103,19 @@ export async function getRawFile( fileName: string, repo: string = config.repository ): Promise<string | null> { - try { - // See: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/src/%7Bcommit%7D/%7Bpath%7D - const path = fileName; - const url = `/2.0/repositories/${repo}/src/HEAD/${path}`; - const res = await bitbucketHttp.get(url); - return res.body; - } catch (err) { - return null; - } + // See: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/src/%7Bcommit%7D/%7Bpath%7D + const path = fileName; + const url = `/2.0/repositories/${repo}/src/HEAD/${path}`; + const res = await bitbucketHttp.get(url); + return res.body; } export async function getJsonFile( fileName: string, repo: string = config.repository ): Promise<any | null> { - try { - const raw = await getRawFile(fileName, repo); - return raw && JSON.parse(raw); - } catch (err) { - return null; - } + const raw = await getRawFile(fileName, repo); + return JSON.parse(raw); } // Initialize bitbucket by getting base branch and SHA diff --git a/lib/platform/gitea/index.spec.ts b/lib/platform/gitea/index.spec.ts index e64331ca4716bfd00a05f14b8009089802e0fb7f..c242124f09ce01e53e87e0f5f60b9d27a27fd4f5 100644 --- a/lib/platform/gitea/index.spec.ts +++ b/lib/platform/gitea/index.spec.ts @@ -1363,19 +1363,17 @@ describe(getName(__filename), () => { const res = await gitea.getJsonFile('file.json'); expect(res).toEqual(data); }); - it('returns null for malformed JSON', async () => { + it('throws on malformed JSON', async () => { helper.getRepoContents.mockResolvedValueOnce({ contentString: '!@#', } as never); await initFakeRepo({ full_name: 'some/repo' }); - const res = await gitea.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(gitea.getJsonFile('file.json')).rejects.toThrow(); }); - it('returns null on errors', async () => { - helper.getRepoContents.mockRejectedValueOnce('some error'); + it('throws on errors', async () => { + helper.getRepoContents.mockRejectedValueOnce(new Error('some error')); await initFakeRepo({ full_name: 'some/repo' }); - const res = await gitea.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(gitea.getJsonFile('file.json')).rejects.toThrow(); }); }); }); diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts index 558ff4c48b394e525c0d3e53e7f1069d5fb028ea..e7f97546a445c251c92b4d8913437f1d7b3bf575 100644 --- a/lib/platform/gitea/index.ts +++ b/lib/platform/gitea/index.ts @@ -212,24 +212,16 @@ const platform: Platform = { fileName: string, repo: string = config.repository ): Promise<string | null> { - try { - const contents = await helper.getRepoContents(repo, fileName); - return contents.contentString; - } catch (err) /* istanbul ignore next */ { - return null; - } + const contents = await helper.getRepoContents(repo, fileName); + return contents.contentString; }, async getJsonFile( fileName: string, repo: string = config.repository ): Promise<any | null> { - try { - const raw = await platform.getRawFile(fileName, repo); - return raw && JSON.parse(raw); - } catch (err) /* istanbul ignore next */ { - return null; - } + const raw = await platform.getRawFile(fileName, repo); + return JSON.parse(raw); }, async initRepo({ diff --git a/lib/platform/github/__snapshots__/index.spec.ts.snap b/lib/platform/github/__snapshots__/index.spec.ts.snap index 3ef809243a2736b512083d4e2ced38bbc6c4b9c0..0e736cb3b322aae11a6c6b2ec623283615780a97 100644 --- a/lib/platform/github/__snapshots__/index.spec.ts.snap +++ b/lib/platform/github/__snapshots__/index.spec.ts.snap @@ -3454,7 +3454,7 @@ Array [ ] `; -exports[`platform/github getJsonFile() returns null for malformed JSON 1`] = ` +exports[`platform/github getJsonFile() throws on errors 1`] = ` Array [ Object { "graphql": Object { @@ -3505,7 +3505,7 @@ Array [ ] `; -exports[`platform/github getJsonFile() returns null on errors 1`] = ` +exports[`platform/github getJsonFile() throws on malformed JSON 1`] = ` Array [ Object { "graphql": Object { diff --git a/lib/platform/github/index.spec.ts b/lib/platform/github/index.spec.ts index 6285f2636d0f5868a83bd8164a1cd84251b78153..1b4d87c64b901acee64330dce394693715cbcac4 100644 --- a/lib/platform/github/index.spec.ts +++ b/lib/platform/github/index.spec.ts @@ -2152,18 +2152,17 @@ describe('platform/github', () => { expect(res).toEqual(data); expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('returns null for malformed JSON', async () => { + it('throws on malformed JSON', async () => { const scope = httpMock.scope(githubApiHost); initRepoMock(scope, 'some/repo'); await github.initRepo({ repository: 'some/repo', token: 'token' } as any); scope.get('/repos/some/repo/contents/file.json').reply(200, { content: Buffer.from('!@#').toString('base64'), }); - const res = await github.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(github.getJsonFile('file.json')).rejects.toThrow(); expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('returns null on errors', async () => { + it('throws on errors', async () => { const scope = httpMock.scope(githubApiHost); initRepoMock(scope, 'some/repo'); await github.initRepo({ repository: 'some/repo', token: 'token' } as any); @@ -2171,8 +2170,7 @@ describe('platform/github', () => { .get('/repos/some/repo/contents/file.json') .replyWithError('some error'); - const res = await github.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(github.getJsonFile('file.json')).rejects.toThrow(); expect(httpMock.getTrace()).toMatchSnapshot(); }); }); diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index d3a10b78b204e15962d1f3c0dd99765d19cc858a..bd20bedc1dd00a0da62a74e9119e9adb7b6a689d 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -145,27 +145,19 @@ export async function getRawFile( fileName: string, repo: string = config.repository ): Promise<string | null> { - try { - const url = `repos/${repo}/contents/${fileName}`; - const res = await githubApi.getJson<{ content: string }>(url); - const buf = res.body.content; - const str = Buffer.from(buf, 'base64').toString(); - return str; - } catch (err) { - return null; - } + const url = `repos/${repo}/contents/${fileName}`; + const res = await githubApi.getJson<{ content: string }>(url); + const buf = res.body.content; + const str = Buffer.from(buf, 'base64').toString(); + return str; } export async function getJsonFile( fileName: string, repo: string = config.repository ): Promise<any | null> { - try { - const raw = await getRawFile(fileName, repo); - return raw && JSON.parse(raw); - } catch (err) { - return null; - } + const raw = await getRawFile(fileName, repo); + return JSON.parse(raw); } let existingRepos; diff --git a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap index 1fa2134260a5e77f060dbd93fe340fdc33864635..4ddc39db5ccda508e08a7d6766575430d948c3da 100644 --- a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap +++ b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap @@ -1551,7 +1551,7 @@ Array [ ] `; -exports[`platform/gitlab getJsonFile() returns null for malformed JSON 1`] = ` +exports[`platform/gitlab getJsonFile() throws on errors 1`] = ` Array [ Object { "headers": Object { @@ -1578,7 +1578,7 @@ Array [ ] `; -exports[`platform/gitlab getJsonFile() returns null on errors 1`] = ` +exports[`platform/gitlab getJsonFile() throws on malformed JSON 1`] = ` Array [ Object { "headers": Object { @@ -1600,7 +1600,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitlab.com/api/v4/projects/some%2Frepo/repository/files/file.json?ref=HEAD", + "url": "https://gitlab.com/api/v4/projects/some%2Frepo/repository/files/dir%2Ffile.json?ref=HEAD", }, ] `; diff --git a/lib/platform/gitlab/index.spec.ts b/lib/platform/gitlab/index.spec.ts index 3979c7a5fef324a5a3984faf226629d1126258b6..7bf98bc4aa5a90870b99c090ba7ce067bd01ce34 100644 --- a/lib/platform/gitlab/index.spec.ts +++ b/lib/platform/gitlab/index.spec.ts @@ -1447,7 +1447,7 @@ These updates have all been created already. Click a checkbox below to force a r expect(res).toEqual(data); expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('returns null for malformed JSON', async () => { + it('throws on malformed JSON', async () => { const scope = await initRepo(); scope .get( @@ -1456,17 +1456,17 @@ These updates have all been created already. Click a checkbox below to force a r .reply(200, { content: Buffer.from('!@#').toString('base64'), }); - const res = await gitlab.getJsonFile('dir/file.json'); - expect(res).toBeNull(); + await expect(gitlab.getJsonFile('dir/file.json')).rejects.toThrow(); expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('returns null on errors', async () => { + it('throws on errors', async () => { const scope = await initRepo(); scope - .get('/api/v4/projects/some%2Frepo/repository/files/file.json?ref=HEAD') + .get( + '/api/v4/projects/some%2Frepo/repository/files/dir%2Ffile.json?ref=HEAD' + ) .replyWithError('some error'); - const res = await gitlab.getJsonFile('file.json'); - expect(res).toBeNull(); + await expect(gitlab.getJsonFile('dir/file.json')).rejects.toThrow(); expect(httpMock.getTrace()).toMatchSnapshot(); }); }); diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts index 06277d9f65de25cc493b35e22fa1de41dd90fddb..09f806d9993d0efed6b652ebb500f9cb788774ea 100755 --- a/lib/platform/gitlab/index.ts +++ b/lib/platform/gitlab/index.ts @@ -143,28 +143,20 @@ export async function getRawFile( fileName: string, repo: string = config.repository ): Promise<string | null> { - try { - const escapedFileName = urlEscape(fileName); - const url = `projects/${repo}/repository/files/${escapedFileName}?ref=HEAD`; - const res = await gitlabApi.getJson<{ content: string }>(url); - const buf = res.body.content; - const str = Buffer.from(buf, 'base64').toString(); - return str; - } catch (err) { - return null; - } + const escapedFileName = urlEscape(fileName); + const url = `projects/${repo}/repository/files/${escapedFileName}?ref=HEAD`; + const res = await gitlabApi.getJson<{ content: string }>(url); + const buf = res.body.content; + const str = Buffer.from(buf, 'base64').toString(); + return str; } export async function getJsonFile( fileName: string, repo: string = config.repository ): Promise<any | null> { - try { - const raw = await getRawFile(fileName, repo); - return raw && JSON.parse(raw); - } catch (err) { - return null; - } + const raw = await getRawFile(fileName, repo); + return JSON.parse(raw); } // Initialize GitLab by getting base branch diff --git a/lib/workers/repository/init/apis.spec.ts b/lib/workers/repository/init/apis.spec.ts index 46401b2af820fe819a6be074648154c5586b6240..b35f28d6f2e8b3cd0137ca87c5df66d4ebe56637 100644 --- a/lib/workers/repository/init/apis.spec.ts +++ b/lib/workers/repository/init/apis.spec.ts @@ -53,6 +53,21 @@ describe('workers/repository/init/apis', () => { }) ).rejects.toThrow(REPOSITORY_FORKED); }); + it('ignores platform.getJsonFile() failures', async () => { + platform.initRepo.mockResolvedValueOnce({ + defaultBranch: 'master', + isFork: false, + }); + platform.getJsonFile.mockRejectedValue(new Error()); + await expect( + initApis({ + ...config, + optimizeForDisabled: true, + includeForks: false, + isFork: true, + }) + ).resolves.not.toThrow(); + }); it('uses the onboardingConfigFileName if set', async () => { platform.initRepo.mockResolvedValueOnce({ defaultBranch: 'master', diff --git a/lib/workers/repository/init/apis.ts b/lib/workers/repository/init/apis.ts index 539a76f465639560387dcae1a41f6d43d849648e..d83b30b1e26a08d9725cd686b15903ff08df6579 100644 --- a/lib/workers/repository/init/apis.ts +++ b/lib/workers/repository/init/apis.ts @@ -17,13 +17,19 @@ const defaultConfigFile = (config: RenovateConfig): string => ? config.onboardingConfigFileName : configFileNames[0]; +async function getJsonFile(file: string): Promise<RenovateConfig | null> { + try { + return await platform.getJsonFile(file); + } catch (err) { + return null; + } +} + async function validateOptimizeForDisabled( config: RenovateConfig ): Promise<void> { if (config.optimizeForDisabled) { - const renovateConfig = await platform.getJsonFile( - defaultConfigFile(config) - ); + const renovateConfig = await getJsonFile(defaultConfigFile(config)); if (renovateConfig?.enabled === false) { throw new Error(REPOSITORY_DISABLED_BY_CONFIG); } @@ -32,9 +38,7 @@ async function validateOptimizeForDisabled( async function validateIncludeForks(config: RenovateConfig): Promise<void> { if (!config.includeForks && config.isFork) { - const renovateConfig = await platform.getJsonFile( - defaultConfigFile(config) - ); + const renovateConfig = await getJsonFile(defaultConfigFile(config)); if (!renovateConfig?.includeForks) { throw new Error(REPOSITORY_FORKED); }