diff --git a/lib/workers/repository/update/pr/changelog/release-notes.spec.ts b/lib/workers/repository/update/pr/changelog/release-notes.spec.ts index 1b493fca5f19f2..e073ea22662b6c 100644 --- a/lib/workers/repository/update/pr/changelog/release-notes.spec.ts +++ b/lib/workers/repository/update/pr/changelog/release-notes.spec.ts @@ -14,6 +14,7 @@ import { getReleaseNotes, getReleaseNotesMd, releaseNotesCacheMinutes, + shouldSkipChangelogMd, } from './release-notes'; import type { ChangeLogNotes, @@ -1340,6 +1341,20 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { }); }); + it('handles skipped packages', async () => { + const res = await getReleaseNotesMd( + { + ...githubProject, + repository: 'facebook/react-native', + }, + partial({ + version: '0.72.3', + gitRef: '0.72.3', + }) + ); + expect(res).toBeNull(); + }); + it('isUrl', () => { expect(versionOneNotes).not.toMatchObject(versionTwoNotes); }); @@ -1348,5 +1363,15 @@ describe('workers/repository/update/pr/changelog/release-notes', () => { expect(versionOneNotes).not.toMatchObject(versionTwoNotes); }); }); + + describe('shouldSkipChangelogMd', () => { + it('should skip for flagged repository', () => { + expect(shouldSkipChangelogMd('facebook/react-native')).toBeTrue(); + }); + + it('should continue for other repository', () => { + expect(shouldSkipChangelogMd('some/repo')).toBeFalse(); + }); + }); }); }); diff --git a/lib/workers/repository/update/pr/changelog/release-notes.ts b/lib/workers/repository/update/pr/changelog/release-notes.ts index 1e3518e64a78a9..588cc1a47cd183 100644 --- a/lib/workers/repository/update/pr/changelog/release-notes.ts +++ b/lib/workers/repository/update/pr/changelog/release-notes.ts @@ -23,6 +23,8 @@ import type { const markdown = new MarkdownIt('zero'); markdown.enable(['heading', 'lheading']); +const repositoriesToSkipMdFetching = ['facebook/react-native']; + export async function getReleaseList( project: ChangeLogProject, release: ChangeLogRelease @@ -302,11 +304,11 @@ export async function getReleaseNotesMd( const { baseUrl, repository } = project; const version = release.version; logger.trace(`getReleaseNotesMd(${repository}, ${version})`); - const skippedRepos = ['facebook/react-native']; - // istanbul ignore if - if (skippedRepos.includes(repository)) { + + if (shouldSkipChangelogMd(repository)) { return null; } + const changelog = await getReleaseNotesMdFile(project); if (!changelog) { return null; @@ -445,3 +447,11 @@ export async function addReleaseNotes( } return output; } + +/** + * Skip fetching changelog/release-notes markdown files. + * Will force a fallback to using GitHub release notes + */ +export function shouldSkipChangelogMd(repository: string): boolean { + return repositoriesToSkipMdFetching.includes(repository); +}