chore(github): improve PR template and cleanup obsolete references | move contribution guide (#9700)

This commit is contained in:
CanbiZ
2025-12-05 23:08:58 +01:00
committed by GitHub
parent 89595627a6
commit 0c2521c05e
17 changed files with 238 additions and 1130 deletions

64
.github/workflows/autolabeler.yml generated vendored
View File

@ -57,10 +57,10 @@ jobs:
if (shouldAddLabel) {
labelsToAdd.add(label);
if (label === "update script") {
// Add specific sub-labels for tools
if (label === "tools") {
for (const prFile of prFiles) {
const filename = prFile.filename;
if (filename.startsWith("vm/")) labelsToAdd.add("vm");
if (filename.startsWith("tools/addon/")) labelsToAdd.add("addon");
if (filename.startsWith("tools/pve/")) labelsToAdd.add("pve-tool");
}
@ -68,38 +68,42 @@ jobs:
}
}
if (labelsToAdd.size < 2) {
const templateLabelMappings = {
"🐞 **Bug fix**": "bugfix",
"✨ **New feature**": "feature",
"💥 **Breaking change**": "breaking change",
"🆕 **New script**": "new script",
"🌍 **Website update**": "website", // handled special
"🔧 **Refactoring / Code Cleanup**": "refactor",
"📝 **Documentation update**": "documentation" // mapped to maintenance
};
// Always parse template checkboxes to add content-type labels (bugfix, feature, etc.)
const templateLabelMappings = {
"🐞 **Bug fix**": "bugfix",
"✨ **New feature**": "feature",
"💥 **Breaking change**": "breaking change",
"🆕 **New script**": "new script",
"🔧 **Refactoring / Code Cleanup**": "refactor",
"📝 **Documentation update**": "documentation"
};
for (const [checkbox, label] of Object.entries(templateLabelMappings)) {
const escapedCheckbox = checkbox.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
const regex = new RegExp(`- \\[(x|X)\\]\\s*${escapedCheckbox}`, "i");
for (const [checkbox, label] of Object.entries(templateLabelMappings)) {
const escapedCheckbox = checkbox.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
const regex = new RegExp(`- \\[(x|X)\\]\\s*${escapedCheckbox}`, "i");
if (regex.test(prBody)) {
if (label === "website") {
const hasJson = prFiles.some((f) => f.filename.startsWith("frontend/public/json/"));
const hasUpdateScript = labelsToAdd.has("update script");
const hasContentLabel = ["bugfix", "feature", "refactor"].some((l) => labelsToAdd.has(l));
if (!(hasUpdateScript && hasContentLabel)) {
labelsToAdd.add(hasJson ? "json" : "website");
}
} else if (label === "documentation") {
labelsToAdd.add("maintenance");
} else {
labelsToAdd.add(label);
}
}
if (regex.test(prBody)) {
labelsToAdd.add(label);
}
}
// Handle website checkbox specially - only add if not already an update script with content label
const websiteCheckbox = "🌍 **Website update**";
const escapedWebsite = websiteCheckbox.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
const websiteRegex = new RegExp(`- \\[(x|X)\\]\\s*${escapedWebsite}`, "i");
if (websiteRegex.test(prBody)) {
const hasJson = prFiles.some((f) => f.filename.startsWith("frontend/public/json/"));
const hasUpdateScript = labelsToAdd.has("update script");
const hasContentLabel = ["bugfix", "feature", "refactor"].some((l) => labelsToAdd.has(l));
// If it's an update script PR with json changes and a content label, skip adding website/json
// The PR should be categorized as update script with the content label
if (!(hasUpdateScript && hasJson && hasContentLabel)) {
labelsToAdd.add(hasJson ? "json" : "website");
}
}
if (labelsToAdd.size === 0) {
labelsToAdd.add("needs triage");
}

33
.github/workflows/changelog-pr.yml generated vendored
View File

@ -157,13 +157,31 @@ jobs:
let categorized = false;
const priorityCategories = categorizedPRs.slice();
// Priority order for content-type labels (highest priority first)
const subCategoryPriority = ["breaking change", "bugfix", "feature", "refactor"];
for (const category of priorityCategories) {
if (categorized) break;
if (category.labels.some(label => prLabels.includes(label))) {
if (category.subCategories && category.subCategories.length > 0) {
const subCategory = category.subCategories.find(sub =>
sub.labels.some(label => prLabels.includes(label))
);
// Find subcategory by priority order instead of first match
let subCategory = null;
for (const priorityLabel of subCategoryPriority) {
if (prLabels.includes(priorityLabel)) {
subCategory = category.subCategories.find(sub =>
sub.labels.includes(priorityLabel)
);
if (subCategory) break;
}
}
// Fallback: check for any other subcategory match (api, github, json, etc.)
if (!subCategory) {
subCategory = category.subCategories.find(sub =>
sub.labels.some(label => prLabels.includes(label))
);
}
if (subCategory) {
subCategory.notes.push(prNote);
@ -176,6 +194,15 @@ jobs:
categorized = true;
}
}
// Fallback: Add to Uncategorized if no category matched
if (!categorized) {
const uncategorized = categorizedPRs.find(category =>
category.title.includes("Uncategorized") || category.labels.includes("needs triage"));
if (uncategorized) {
uncategorized.notes.push(prNote);
}
}
}
}

View File

@ -51,10 +51,6 @@ jobs:
NON_COMPLIANT_FILES=""
for FILE in $CHANGED_FILES; do
# Skip File "misc/create_lxc.sh"
if [[ "$FILE" == "misc/create_lxc.sh" ]]; then
continue
fi
BASENAME=$(echo "$(basename "${FILE%.*}")")
if [[ ! "$BASENAME" =~ ^[a-z0-9-]+$ ]]; then
NON_COMPLIANT_FILES="$NON_COMPLIANT_FILES $FILE"