diff --git a/__tests__/whatsnew-ca b/__tests__/whatsnew-ca new file mode 100644 index 00000000..db8f2084 --- /dev/null +++ b/__tests__/whatsnew-ca @@ -0,0 +1 @@ +test_changelog_file_catalan \ No newline at end of file diff --git a/__tests__/whatsnew-es-ES b/__tests__/whatsnew-es-ES new file mode 100644 index 00000000..66a69be8 --- /dev/null +++ b/__tests__/whatsnew-es-ES @@ -0,0 +1 @@ +test_changelog_file_spanish \ No newline at end of file diff --git a/__tests__/whatsnew-et b/__tests__/whatsnew-et new file mode 100644 index 00000000..1dbd0d33 --- /dev/null +++ b/__tests__/whatsnew-et @@ -0,0 +1 @@ +test_changelog_file_estonian \ No newline at end of file diff --git a/__tests__/whatsnew.test.ts b/__tests__/whatsnew.test.ts index cc76174e..13257cfa 100644 --- a/__tests__/whatsnew.test.ts +++ b/__tests__/whatsnew.test.ts @@ -7,7 +7,7 @@ import LocalizedText = androidpublisher_v3.Schema$LocalizedText; test("read localized whatsnew files", async () => { let texts = await readLocalizedReleaseNotes("./__tests__"); - expect(texts).toHaveLength(3); + expect(texts).toHaveLength(6); expect(texts).toContainEqual({ language: "en-US", text: "test_changelog_file" @@ -20,4 +20,16 @@ test("read localized whatsnew files", async () => { language: "ja-JP", text: "test_changelog_file_japanese" }); + expect(texts).toContainEqual({ + language: "ca", + text: "test_changelog_file_catalan" + }); + expect(texts).toContainEqual({ + language: "es-ES", + text: "test_changelog_file_spanish" + }); + expect(texts).toContainEqual({ + language: "et", + text: "test_changelog_file_estonian" + }); }); \ No newline at end of file diff --git a/src/whatsnew.ts b/src/whatsnew.ts index a5c7e1c2..7db3894d 100644 --- a/src/whatsnew.ts +++ b/src/whatsnew.ts @@ -6,10 +6,11 @@ import {androidpublisher_v3} from "googleapis"; import LocalizedText = androidpublisher_v3.Schema$LocalizedText; export async function readLocalizedReleaseNotes(whatsNewDir: string | undefined): Promise { + core.debug(`Executing readLocalizedReleaseNotes`); if (whatsNewDir != undefined && whatsNewDir.length > 0) { const releaseNotes = fs.readdirSync(whatsNewDir) - .filter(value => /whatsnew-.*-.{2,3}\b/.test(value)); - const pattern = /whatsnew-(?.*-.*)/; + .filter(value => /whatsnew-((.*-.*)|(.*))\b/.test(value)); + const pattern = /whatsnew-(?(.*-.*)|(.*))/; let localizedReleaseNotes: LocalizedText[] = []; @@ -17,7 +18,7 @@ export async function readLocalizedReleaseNotes(whatsNewDir: string | undefined) releaseNotes.forEach(value => { const matches = value.match(pattern); core.debug(`Matches for ${value} = ${matches}`); - if (matches != undefined && matches.length == 2) { + if (matches != undefined && matches.length == 4) { const lang = matches[1]; const filePath = path.join(whatsNewDir, value); const content = readFileSync(filePath, 'utf-8');