Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Normalize release notes changelog sync

Manav Rathid476b573a6ac
diff --git a/.github/scripts/sync-help-changelog.mjs b/.github/scripts/sync-help-changelog.mjs
index eee9eb0f0e..dcf8a56993 100644
--- a/.github/scripts/sync-help-changelog.mjs
+++ b/.github/scripts/sync-help-changelog.mjs
@@ -17,6 +17,13 @@ const apps = {
ensu: { changelog: "docs/docs/ensu/changelog.md", label: undefined },
};
+const normalizeReleaseBodyIndent = (body) => {
+ const lines = body.replace(/\r\n?/g, "\n").split("\n");
+ const indents = lines.filter((line) => line.trim()).map((line) => line.match(/^[ \t]*/)[0].length);
+ const indent = indents.length ? Math.min(...indents) : 0;
+ return lines.map((line) => line.slice(indent)).join("\n").trim();
+};
+
const [app, version] = process.argv.slice(2);
const config = apps[app];
if (!config || !version) {
@@ -33,7 +40,7 @@ if (content.includes(`${heading} - `)) {
}
const date = new Date().toLocaleString("en-US", { month: "short", year: "numeric", timeZone: "UTC" });
-const body = (process.env.RELEASE_BODY ?? "").trim();
+const body = normalizeReleaseBodyIndent(process.env.RELEASE_BODY ?? "");
const section = `${heading} - ${date}\n\n${body}\n`;
const at = content.search(/^## v/m);