From a82aeef2eb7fb1e63f2eda2676d6decbc22c0003 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Fri, 17 Jul 2026 08:07:28 +0200 Subject: [PATCH] =?UTF-8?q?add=20header=20to=20release=20pr.=20remove=20?= =?UTF-8?q?=F0=9F=93=A6=EF=B8=8F=20Dependencies=20from=20release=20descrip?= =?UTF-8?q?tion=20(#3144)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .codacy.yml | 1 + release-config.ts | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/.codacy.yml b/.codacy.yml index fca7688cc4..a3a7c00220 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -15,6 +15,7 @@ exclude_paths: - 'idp/src/**' - 'devtools/**' - 'deployments/**' + - "release-config.ts" - 'tests/acceptance/expected-failures-*.md' - 'tests/acceptance/bootstrap/**' - 'tests/acceptance/TestHelpers/**' diff --git a/release-config.ts b/release-config.ts index 692fca1700..8f1aef8d6d 100644 --- a/release-config.ts +++ b/release-config.ts @@ -73,6 +73,38 @@ export default { const latestTag = tags.pop() || "v0.0.0"; return compareVersions(latestTag, nextVersion) === -1; }, + getReleaseDescription: async ({ nextVersion }) => { + const note = + "> [!IMPORTANT]\n" + + "> This is a rolling release. Learn here about the [release types and lifecycle](https://docs.opencloud.eu/docs/admin/resources/lifecycle#release-types).\n\n"; + + // Exclude the "📦️ Dependencies" section from the release description + const section = removeChangelogSubsection( + await getChangelogSection(nextVersion), + "📦️ Dependencies" + ); + + return `${note}${section}`; + }, +}; +// helper functions +const getChangelogSection = async (nextVersion: string) => { + const { promises: fs } = await import("fs"); + const changelog = await fs.readFile("CHANGELOG.md", "utf-8").catch(() => ""); + + const section = changelog + .split(/\n(?=## \[)/) + .find((s) => s.startsWith(`## [${nextVersion}]`)); + + return section?.trim() ?? ""; +}; + +const removeChangelogSubsection = (section: string, heading: string) => { + return section + .split(/\n(?=### )/) + .filter((s) => !s.startsWith(`### ${heading}`)) + .join("\n") + .trim(); }; const parseVersion = (tag: string) => {