scripts/release/module-automation/commons.js
// Update changelogs and create PR in widget-resources
Update changelogs and create PR in widget-resources
Update changelogs and create PR in widget - resources
async function updateChangelogs(widgetsFolders, moduleInfo) {
    console.log("Updating changelogs..");
    const moduleChangelogs = await getUnreleasedChangelogs(moduleInfo);
    const nativeWidgetsChangelogs = [];
    for await (const folder of widgetsFolders) {
        const widgetInfo = await getPackageInfo(folder);
        if (!widgetInfo) {
            continue;
        }
        const widgetChangelogs = await getUnreleasedChangelogs(widgetInfo);
        if (widgetChangelogs) {
            nativeWidgetsChangelogs.push(`## [${widgetInfo.version}] ${widgetInfo.nameWithSpace}\n${widgetChangelogs}`);
            console.log(`Writing "${widgetInfo.nameWithSpace}" changelogs to ${widgetInfo.changelogPath}`);
            await writeToWidgetChangelogs(widgetChangelogs, widgetInfo);
        }
    }
    const newModuleChangelogs = nativeWidgetsChangelogs.length
        ? `${moduleChangelogs}\n\n${nativeWidgetsChangelogs.join("\n\n")}`
        : moduleChangelogs;
    if (newModuleChangelogs) {
        console.log(`Writing "${moduleInfo.nameWithSpace}" changelogs to ${moduleInfo.changelogPath}`);
        await writeToModuleChangelogs(newModuleChangelogs, moduleInfo);
    }
    const changelogBranchName = `${moduleInfo.nameWithDash}-release-${moduleInfo.version}`;
    await execShellCommand(
        `git checkout -b ${changelogBranchName} && git add . && git commit -m "chore(${moduleInfo.nameWithDash}): update changelogs" && git push --set-upstream origin ${changelogBranchName}`
    );
    await execShellCommand(
        `gh pr create --title "Updating all the changelogs" --body "This is an automated PR." --base master --head ${changelogBranchName}`
    );
    console.log("Created PR for changelog updates.");
    return newModuleChangelogs;
}
async function updateChangelogs ( widgetsFolders , moduleInfo ) { console . log ( "Updating changelogs.." ) ; const moduleChangelogs = await getUnreleasedChangelogs ( moduleInfo ) ; const nativeWidgetsChangelogs = [ ] ; for await ( const folder of widgetsFolders ) { const widgetInfo = await getPackageInfo ( folder ) ; if ( ! widgetInfo ) { continue ; } const widgetChangelogs = await getUnreleasedChangelogs ( widgetInfo ) ; if ( widgetChangelogs ) { nativeWidgetsChangelogs . push ( ` ${ widgetInfo . version } ${ widgetInfo . nameWithSpace } \n ${ widgetChangelogs } ` ) ; console . log ( ` ${ widgetInfo . nameWithSpace } ${ widgetInfo . changelogPath } ` ) ; await writeToWidgetChangelogs ( widgetChangelogs , widgetInfo ) ; } } const newModuleChangelogs = nativeWidgetsChangelogs . length ? ` ${ moduleChangelogs } \n \n ${ nativeWidgetsChangelogs . join ( "\n\n" ) } ` : moduleChangelogs ; if ( newModuleChangelogs ) { console . log ( ` ${ moduleInfo . nameWithSpace } ${ moduleInfo . changelogPath } ` ) ; await writeToModuleChangelogs ( newModuleChangelogs , moduleInfo ) ; } const changelogBranchName = ` ${ moduleInfo . nameWithDash } ${ moduleInfo . version } ` ; await execShellCommand ( ` ${ changelogBranchName } ${ moduleInfo . nameWithDash } ${ changelogBranchName } ` ) ; await execShellCommand ( ` ${ changelogBranchName } ` ) ; console . log ( "Created PR for changelog updates." ) ; return newModuleChangelogs ; }
Update changelogs and create PR in widget-resources
Update changelogs and create PR in widget - resources