Update changelog-pr.yml

This commit is contained in:
CanbiZ 2025-02-24 15:07:13 +01:00 committed by GitHub
parent 8c41fb692b
commit 375275b9c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -78,11 +78,30 @@ jobs:
const prLabels = pr.labels.map(label => label.name.toLowerCase()); const prLabels = pr.labels.map(label => label.name.toLowerCase());
const prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`; const prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`;
let isCategorized = false;
for (const { labels, notes } of categorizedPRs) { for (const { labels, notes } of categorizedPRs) {
if (labels.length === 0 || labels.some(label => prLabels.includes(label))) { // If no labels are specified (e.g., "Unlabelled"), assign to this category
if (labels.length === 0 && prLabels.length === 0) {
notes.push(prNote); notes.push(prNote);
isCategorized = true;
break; break;
} }
// If labels are specified, check if PR has ALL required labels
if (labels.length > 0 && labels.every(label => prLabels.includes(label.toLowerCase()))) {
notes.push(prNote);
isCategorized = true;
break;
}
}
// If PR is not categorized, assign it to the "Unlabelled" category
if (!isCategorized) {
const unlabelledCategory = categorizedPRs.find(cat => cat.title === "❔ Unlabelled");
if (unlabelledCategory) {
unlabelledCategory.notes.push(prNote);
}
} }
}); });
@ -110,7 +129,6 @@ jobs:
const changelogContent = await fs.readFile(changelogPath, 'utf-8'); const changelogContent = await fs.readFile(changelogPath, 'utf-8');
const changelogIncludesTodaysReleaseNotes = changelogContent.includes(`\n## ${today}`); const changelogIncludesTodaysReleaseNotes = changelogContent.includes(`\n## ${today}`);
// Ersetze oder füge Release Notes ein
const regex = changelogIncludesTodaysReleaseNotes const regex = changelogIncludesTodaysReleaseNotes
? new RegExp(`## ${today}.*(?=## ${latestDateInChangelog})`, "gs") ? new RegExp(`## ${today}.*(?=## ${latestDateInChangelog})`, "gs")
: new RegExp(`(?=## ${latestDateInChangelog})`, "gs"); : new RegExp(`(?=## ${latestDateInChangelog})`, "gs");