1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-03-08 13:19:05 +00:00

Update changelog-pr.yml

This commit is contained in:
CanbiZ 2025-02-21 10:40:28 +01:00 committed by GitHub
parent dd8db43dea
commit 209aa220b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,7 +56,6 @@ jobs:
const fileContent = await fs.readFile(configPath, 'utf-8'); const fileContent = await fs.readFile(configPath, 'utf-8');
let changelogConfig = JSON.parse(fileContent); let changelogConfig = JSON.parse(fileContent);
// Reihenfolge der Kategorien beibehalten
const order = [ const order = [
"💥 Breaking Changes", "💥 Breaking Changes",
"🆕 New Scripts", "🆕 New Scripts",
@ -87,7 +86,7 @@ jobs:
}); });
if (!pulls || pulls.length === 0) { if (!pulls || pulls.length === 0) {
console.log("⚠️ No merged PRs found. create empty Changelog."); console.log("⚠️ No merged PRs found. Generating empty changelog.");
core.setOutput("result", JSON.stringify([])); core.setOutput("result", JSON.stringify([]));
return; return;
} }
@ -101,7 +100,6 @@ jobs:
const prBody = pr.body ? pr.body.toLowerCase() : ""; const prBody = pr.body ? pr.body.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}))`;
// Mapping für PR-Checkboxen → Labels
const templateLabelMappings = { const templateLabelMappings = {
"🐞 bug fix": "bugfix", "🐞 bug fix": "bugfix",
"✨ new feature": "feature", "✨ new feature": "feature",
@ -113,7 +111,7 @@ jobs:
for (const [checkbox, label] of Object.entries(templateLabelMappings)) { for (const [checkbox, label] of Object.entries(templateLabelMappings)) {
const regex = new RegExp(`- \\[(.*?)\\] ${checkbox}`, "i"); const regex = new RegExp(`- \\[(.*?)\\] ${checkbox}`, "i");
const match = prBody.match(regex); const match = prBody.match(regex);
if (match && match[1].trim() !== "") { // Checkbox ist gesetzt if (match && match[1].trim() !== "") {
prLabels.push(label); prLabels.push(label);
addedByTemplate = true; addedByTemplate = true;
} }
@ -141,11 +139,12 @@ jobs:
} }
if (addedByTemplate) { if (addedByTemplate) {
console.log(`PR #${pr.number} added by PR-Template category`); console.log(`PR #${pr.number} categorized via PR template selection.`);
} }
}); });
core.setOutput("result", JSON.stringify(categorizedPRs)); core.setOutput("result", JSON.stringify(categorizedPRs.length ? categorizedPRs : []));
- name: Update CHANGELOG.md - name: Update CHANGELOG.md
uses: actions/github-script@v7 uses: actions/github-script@v7