Skip to content

Commit 375275b

Browse files
authored
Update changelog-pr.yml
1 parent 8c41fb6 commit 375275b

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/changelog-pr.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,31 @@ jobs:
7878
const prLabels = pr.labels.map(label => label.name.toLowerCase());
7979
const prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`;
8080
81+
let isCategorized = false;
82+
8183
for (const { labels, notes } of categorizedPRs) {
82-
if (labels.length === 0 || labels.some(label => prLabels.includes(label))) {
84+
// If no labels are specified (e.g., "Unlabelled"), assign to this category
85+
if (labels.length === 0 && prLabels.length === 0) {
86+
notes.push(prNote);
87+
isCategorized = true;
88+
break;
89+
}
90+
91+
// If labels are specified, check if PR has ALL required labels
92+
if (labels.length > 0 && labels.every(label => prLabels.includes(label.toLowerCase()))) {
8393
notes.push(prNote);
94+
isCategorized = true;
8495
break;
8596
}
8697
}
98+
99+
// If PR is not categorized, assign it to the "Unlabelled" category
100+
if (!isCategorized) {
101+
const unlabelledCategory = categorizedPRs.find(cat => cat.title === "❔ Unlabelled");
102+
if (unlabelledCategory) {
103+
unlabelledCategory.notes.push(prNote);
104+
}
105+
}
87106
});
88107
89108
return categorizedPRs;
@@ -110,7 +129,6 @@ jobs:
110129
const changelogContent = await fs.readFile(changelogPath, 'utf-8');
111130
const changelogIncludesTodaysReleaseNotes = changelogContent.includes(`\n## ${today}`);
112131
113-
// Ersetze oder füge Release Notes ein
114132
const regex = changelogIncludesTodaysReleaseNotes
115133
? new RegExp(`## ${today}.*(?=## ${latestDateInChangelog})`, "gs")
116134
: new RegExp(`(?=## ${latestDateInChangelog})`, "gs");

0 commit comments

Comments
 (0)