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

[gh] Furhter Impove Changelog Workflow (#2655)

* Impove Workflow

* Impove Workflow
This commit is contained in:
Michel Roegl-Brunner 2025-02-26 15:38:35 +02:00 committed by GitHub
parent a971cedde5
commit 46462a790c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 156 additions and 87 deletions

View File

@ -1,17 +1,5 @@
{ {
"breaking change": [
{
"fileStatus": "renamed",
"includeGlobs": ["ct/**", "install/**", "misc/**", "turnkey/**", "vm/**"],
"excludeGlobs": []
},
{
"fileStatus": "removed",
"includeGlobs": ["ct/**", "install/**", "misc/**", "turnkey/**", "vm/**"],
"excludeGlobs": []
}
],
"new script": [ "new script": [
{ {
"fileStatus": "added", "fileStatus": "added",
@ -33,10 +21,17 @@
"excludeGlobs": [] "excludeGlobs": []
} }
], ],
"rename script": [ "maintenance": [
{ {
"fileStatus": "renamed", "fileStatus": null,
"includeGlobs": ["ct/**", "install/**", "misc/**", "turnkey/**", "vm/**"], "includeGlobs": ["*.md", ".github/**", "misc/*.func", "ct/create_lxc.sh", "api/**"],
"excludeGlobs": []
}
],
"core": [
{
"fileStatus": null,
"includeGlobs": ["misc/*.func", "ct/create_lxc.sh"],
"excludeGlobs": [] "excludeGlobs": []
} }
], ],
@ -47,20 +42,28 @@
"excludeGlobs": [] "excludeGlobs": []
} }
], ],
"maintenance": [ "api": [
{
"fileStatus": null,
"includeGlobs": ["*.md", ".github/**", "misc/*.func", "ct/create_lxc.sh"],
"excludeGlobs": ["misc/api.func"]
}
],
"api": [
{ {
"fileStatus": null, "fileStatus": null,
"includeGlobs": ["api/**", "misc/api.func"], "includeGlobs": ["api/**", "misc/api.func"],
"excludeGlobs": [] "excludeGlobs": []
} }
], ],
"github": [
{
"fileStatus": null,
"includeGlobs": [".github/**"],
"excludeGlobs": []
}
],
"json": [
{
"fileStatus": "modified",
"includeGlobs": ["json/**"],
"excludeGlobs": []
}
],
"high risk": [ "high risk": [
{ {
"fileStatus": null, "fileStatus": null,
@ -68,4 +71,6 @@
"excludeGlobs": [] "excludeGlobs": []
} }
] ]
} }

View File

@ -1,16 +1,8 @@
[ [
{
"title": "💥 Breaking Changes",
"labels": ["breaking change"]
},
{ {
"title": "🆕 New Scripts", "title": "🆕 New Scripts",
"labels": ["new script"] "labels": ["new script"]
}, },
{
"title": "✨ New Features",
"labels": ["feature"]
},
{ {
"title": "🚀 Updated Scripts", "title": "🚀 Updated Scripts",
"labels": ["update script"], "labels": ["update script"],
@ -21,27 +13,85 @@
"notes" : [] "notes" : []
}, },
{ {
"title": "General Updates", "title": "✨ New Features",
"labels": ["general"], "labels": ["feature"],
"notes" : []
},
{
"title": "💥 Breaking Changes",
"labels": ["breaking change"],
"notes" : [] "notes" : []
} }
] ]
}, },
{
"title": "🌐 Website",
"labels": ["website"]
},
{
"title": "📡 API",
"labels": ["api"]
},
{ {
"title": "🧰 Maintenance", "title": "🧰 Maintenance",
"labels": ["maintenance"] "labels": ["maintenance"],
"subCategories": [
{
"title": "🐞 Bug Fixes",
"labels": ["bugfix"],
"notes" : []
},
{
"title": "✨ New Features",
"labels": ["feature"],
"notes" : []
},
{
"title": "💥 Breaking Changes",
"labels": ["breaking change"],
"notes" : []
},
{
"title": "📡 API",
"labels": ["api"],
"notes" : []
},
{
"title": "💾 Core",
"labels": ["core"],
"notes" : []
},
{
"title": "📂 Github",
"labels": ["github"],
"notes" : []
}
]
},
{
"title": "🌐 Website",
"labels": ["website"],
"subCategories": [
{
"title": "🐞 Bug Fixes",
"labels": ["bugfix"],
"notes" : []
},
{
"title": "✨ New Features",
"labels": ["feature"],
"notes" : []
},
{
"title": "💥 Breaking Changes",
"labels": ["breaking change"],
"notes" : []
},
{
"title": "📝 Script Information",
"labels": ["json"],
"notes" : []
}
]
}, },
{ {
"title": "❔ Unlabelled", "title": "❔ Unlabelled",
"labels": [] "labels": []
},
{
"title": "💥 Breaking Changes",
"labels": ["breaking change"]
} }
] ]

View File

@ -1,25 +1,25 @@
## ✍️ Description ## ✍️ Description
<!-- Provide a clear and concise description of your changes. --> <!-- Provide a clear and concise description of your changes. -->
## 🔗 Related PR / Discussion / Issue ## 🔗 Related PR / Discussion / Issue
Link: # Link: #
## ✅ Prerequisites ## ✅ Prerequisites
Before this PR can be reviewed, the following must be completed: Before this PR can be reviewed, the following must be completed:
- [] **Self-review performed** Code follows established patterns and conventions. - [] **Self-review performed** Code follows established patterns and conventions.
- [] **Testing performed** Changes have been thoroughly tested and verified. - [] **Testing performed** Changes have been thoroughly tested and verified.
## 🛠️ Type of Change ## 🛠️ Type of Change
Select all that apply:
- [] 🐞 **Bug fix** Resolves an issue without breaking functionality.
- [] ✨ **New feature** Adds new, non-breaking functionality.
- [] 💥 **Breaking change** Alters existing functionality in a way that may require updates.
- [] 🆕 **New script** A fully functional and tested script or script set.
Select all that apply:
- [] 🆕 **New script** A fully functional and tested script or script set.
- [] 🐞 **Bug fix** Resolves an issue without breaking functionality.
- [] ✨ **New feature** Adds new, non-breaking functionality.
- [] 💥 **Breaking change** Alters existing functionality in a way that may require updates.
## 📋 Additional Information (optional) ## 📋 Additional Information (optional)
<!-- Provide extra context, screenshots, or references if needed. --> <!-- Provide extra context, screenshots, or references if needed. -->

View File

@ -11,7 +11,7 @@ jobs:
permissions: permissions:
pull-requests: write pull-requests: write
env: env:
CONFIG_PATH: .github/autolabeler-config.json CONFIG_PATH: .github/autolabeler-config_new.json
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -43,25 +43,7 @@ jobs:
}); });
const prFiles = prListFilesResponse.data; const prFiles = prListFilesResponse.data;
const templateLabelMappings = {
"🐞 **bug fix**": "bugfix",
"✨ **new feature**": "feature",
"💥 **breaking change**": "breaking change",
"🆕 **new script**": "new script"
};
for (const [checkbox, label] of Object.entries(templateLabelMappings)) {
const escapedCheckbox = checkbox.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
const regex = new RegExp(`- \\[(x|X)\\]\\s*.*${escapedCheckbox}`, "i");
const match = prBody.match(regex);
if (match) {
console.log(`Match: ${match}`);
labelsToAdd.add(label);
}
}
if (labelsToAdd.size === 0) {
labelsToAdd.add("general");
}
// Apply labels based on file changes // Apply labels based on file changes
for (const [label, rules] of Object.entries(autolabelerConfig)) { for (const [label, rules] of Object.entries(autolabelerConfig)) {
@ -79,6 +61,21 @@ jobs:
labelsToAdd.add(label); labelsToAdd.add(label);
} }
} }
const templateLabelMappings = {
"🐞 **Bug fix**": "bugfix",
"✨ **New feature**": "feature",
"💥 **Breaking change**": "breaking change",
};
for (const [checkbox, label] of Object.entries(templateLabelMappings)) {
const escapedCheckbox = checkbox.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
const regex = new RegExp(`- \\[(x|X)\\]\\s*.*${escapedCheckbox}`, "i");
const match = prBody.match(regex);
if (match) {
console.log(`Match: ${match}`);
labelsToAdd.add(label);
}
}
console.log(`Labels to add: ${Array.from(labelsToAdd).join(", ")}`); console.log(`Labels to add: ${Array.from(labelsToAdd).join(", ")}`);

View File

@ -58,10 +58,26 @@ jobs:
const categorizedPRs = changelogConfig.map(obj => ({ const categorizedPRs = changelogConfig.map(obj => ({
...obj, ...obj,
notes: [], notes: [],
subCategories: obj.subCategories ?? (obj.labels.includes("update script") ? [ subCategories: obj.subCategories ?? (
{ title: "🐞 Bug Fixes", labels: ["bugfix"] }, obj.labels.includes("update script") ? [
{ title: "✨ Feature Updates", labels: ["feature"] } { title: "🐞 Bug Fixes", labels: ["bugfix"], notes: [] },
] : []) { title: "✨ New Features", labels: ["feature"], notes: [] },
{ title: "💥 Breaking Changes", labels: ["breaking change"], notes: [] }
] :
obj.labels.includes("maintenance") ? [
{ title: "🐞 Bug Fixes", labels: ["bugfix"], notes: [] },
{ title: "✨ New Features", labels: ["feature"], notes: [] },
{ title: "💥 Breaking Changes", labels: ["breaking change"], notes: [] },
{ title: "📡 API", labels: ["api"], notes: [] },
{ title: "Github", labels: ["github"], notes: [] }
] :
obj.labels.includes("website") ? [
{ title: "🐞 Bug Fixes", labels: ["bugfix"], notes: [] },
{ title: "✨ New Features", labels: ["feature"], notes: [] },
{ title: "💥 Breaking Changes", labels: ["breaking change"], notes: [] },
{ title: "Script Information", labels: ["json"], notes: [] }
] : []
)
})); }));
const latestDateInChangelog = new Date(process.env.LATEST_DATE); const latestDateInChangelog = new Date(process.env.LATEST_DATE);
@ -110,6 +126,7 @@ jobs:
return categorizedPRs; return categorizedPRs;
- name: Update CHANGELOG.md - name: Update CHANGELOG.md
uses: actions/github-script@v7 uses: actions/github-script@v7
with: with:
@ -124,7 +141,8 @@ jobs:
console.log(JSON.stringify(categorizedPRs, null, 2)); console.log(JSON.stringify(categorizedPRs, null, 2));
let newReleaseNotes = `## ${today}\n\n### Changes\n\n`;
let newReleaseNotes = `## ${today}\n\n`;
for (const { title, notes, subCategories } of categorizedPRs) { for (const { title, notes, subCategories } of categorizedPRs) {
const hasSubcategories = subCategories && subCategories.length > 0; const hasSubcategories = subCategories && subCategories.length > 0;
const hasMainNotes = notes.length > 0; const hasMainNotes = notes.length > 0;
@ -136,14 +154,13 @@ jobs:
} }
if (hasMainNotes) { if (hasMainNotes) {
newReleaseNotes += `${notes.join("\n")}\n\n`; newReleaseNotes += ` ${notes.join("\n")}\n\n`;
} }
if (hasSubcategories) { if (hasSubcategories) {
for (const { title: subTitle, notes: subNotes } of subCategories) { for (const { title: subTitle, notes: subNotes } of subCategories) {
if (subNotes && subNotes.length > 0) { if (subNotes && subNotes.length > 0) {
newReleaseNotes += ` #### ${subTitle}\n\n`; newReleaseNotes += ` - #### ${subTitle}\n\n`;
newReleaseNotes += ` ${subNotes.join("\n ")}\n\n`; newReleaseNotes += ` ${subNotes.join("\n ")}\n\n`;
} }
} }
} }