async function addAllReleaseNotes()

in Tasks/GooglePlayReleaseV4/modules/metadataHelper.ts [54:83]


async function addAllReleaseNotes(versionCodes: number[], languageCode: string, directory: string): Promise<pub3.Schema$LocalizedText[]> {
    const changelogDir: string = path.join(directory, 'changelogs');

    const changelogs: string[] = filterDirectoryContents(changelogDir, stat => stat.isFile());

    if (changelogs.length === 0) {
        return [];
    }

    const releaseNotes: pub3.Schema$LocalizedText[] = [];
    for (const changelogFile of changelogs) {
        const changelogName: string = path.basename(changelogFile, path.extname(changelogFile));
        const changelogVersion: number = parseInt(changelogName, 10);
        if (!isNaN(changelogVersion) && (versionCodes.indexOf(changelogVersion) !== -1)) {
            const fullChangelogPath: string = path.join(changelogDir, changelogFile);

            console.log(tl.loc('AppendChangelog', fullChangelogPath));
            releaseNotes.push({
                language: languageCode,
                text: getChangelog(fullChangelogPath)
            });
            tl.debug(`Found release notes version ${changelogVersion} from ${fullChangelogPath} for language code ${languageCode}`);
        } else {
            tl.debug(`The name of the file ${changelogFile} is not a valid version code. Skipping it.`);
        }
    }

    tl.debug(`All release notes found for ${changelogDir}: ${JSON.stringify(releaseNotes)}`);
    return releaseNotes;
}