Github: AutoLabler | ChangeLog (Refactor) (#5868)

This commit is contained in:
CanbiZ
2025-07-09 14:09:11 +02:00
committed by GitHub
parent 5d1f0ab13e
commit 2ff778db9a
4 changed files with 124 additions and 79 deletions

57
.github/autolabeler-config.json generated vendored
View File

@ -4,6 +4,7 @@
"fileStatus": "added", "fileStatus": "added",
"includeGlobs": [ "includeGlobs": [
"ct/**", "ct/**",
"tools/**",
"install/**", "install/**",
"misc/**", "misc/**",
"turnkey/**", "turnkey/**",
@ -17,16 +18,13 @@
"fileStatus": "modified", "fileStatus": "modified",
"includeGlobs": [ "includeGlobs": [
"ct/**", "ct/**",
"tools/**",
"install/**", "install/**",
"misc/**", "misc/**",
"turnkey/**", "turnkey/**",
"vm/**" "vm/**"
], ],
"excludeGlobs": [ "excludeGlobs": []
"misc/build.func",
"misc/install.func",
"misc/api.func"
]
} }
], ],
"delete script": [ "delete script": [
@ -34,6 +32,21 @@
"fileStatus": "removed", "fileStatus": "removed",
"includeGlobs": [ "includeGlobs": [
"ct/**", "ct/**",
"tools/**",
"install/**",
"misc/**",
"turnkey/**",
"vm/**"
],
"excludeGlobs": []
}
],
"breaking change": [
{
"fileStatus": null,
"includeGlobs": [
"ct/**",
"tools/**",
"install/**", "install/**",
"misc/**", "misc/**",
"turnkey/**", "turnkey/**",
@ -46,11 +59,7 @@
{ {
"fileStatus": null, "fileStatus": null,
"includeGlobs": [ "includeGlobs": [
"*.md", "*.md"
".github/**",
"misc/*.func",
"misc/create_lxc.sh",
"api/**"
], ],
"excludeGlobs": [] "excludeGlobs": []
} }
@ -62,7 +71,9 @@
"misc/*.func", "misc/*.func",
"misc/create_lxc.sh" "misc/create_lxc.sh"
], ],
"excludeGlobs": [] "excludeGlobs": [
"misc/api.func"
]
} }
], ],
"website": [ "website": [
@ -71,7 +82,9 @@
"includeGlobs": [ "includeGlobs": [
"frontend/**" "frontend/**"
], ],
"excludeGlobs": [] "excludeGlobs": [
"frontend/public/json/**"
]
} }
], ],
"api": [ "api": [
@ -102,26 +115,6 @@
"excludeGlobs": [] "excludeGlobs": []
} }
], ],
"high risk": [
{
"fileStatus": null,
"includeGlobs": [
"misc/build.func",
"misc/install.func",
"misc/create_lxc.sh"
],
"excludeGlobs": []
}
],
"documentation": [
{
"fileStatus": null,
"includeGlobs": [
"*.md"
],
"excludeGlobs": []
}
],
"addon": [ "addon": [
{ {
"fileStatus": null, "fileStatus": null,

120
.github/changelog-pr-config.json generated vendored
View File

@ -1,112 +1,148 @@
[ [
{ {
"title": "🆕 New Scripts", "title": "🆕 New Scripts",
"labels": ["new script"] "labels": [
"new script"
]
}, },
{ {
"title": "🚀 Updated Scripts", "title": "🚀 Updated Scripts",
"labels": ["update script"], "labels": [
"update script"
],
"subCategories": [ "subCategories": [
{ {
"title": "🐞 Bug Fixes", "title": "🐞 Bug Fixes",
"labels": ["bugfix"], "labels": [
"notes" : [] "bugfix"
],
"notes": []
}, },
{ {
"title": "✨ New Features", "title": "✨ New Features",
"labels": ["feature"], "labels": [
"notes" : [] "feature"
],
"notes": []
}, },
{ {
"title": "💥 Breaking Changes", "title": "💥 Breaking Changes",
"labels": ["breaking change"], "labels": [
"notes" : [] "breaking change"
],
"notes": []
}, },
{ {
"title": "🔧 Refactor", "title": "🔧 Refactor",
"labels": ["refactor"], "labels": [
"notes" : [] "refactor"
],
"notes": []
} }
] ]
}, },
{ {
"title": "🧰 Maintenance", "title": "🧰 Maintenance",
"labels": ["maintenance"], "labels": [
"maintenance"
],
"subCategories": [ "subCategories": [
{ {
"title": "🐞 Bug Fixes", "title": "🐞 Bug Fixes",
"labels": ["bugfix"], "labels": [
"notes" : [] "bugfix"
],
"notes": []
}, },
{ {
"title": "✨ New Features", "title": "✨ New Features",
"labels": ["feature"], "labels": [
"notes" : [] "feature"
],
"notes": []
}, },
{ {
"title": "💥 Breaking Changes", "title": "💥 Breaking Changes",
"labels": ["breaking change"], "labels": [
"notes" : [] "breaking change"
],
"notes": []
}, },
{ {
"title": "📡 API", "title": "📡 API",
"labels": ["api"], "labels": [
"notes" : [] "api"
],
"notes": []
}, },
{ {
"title": "💾 Core", "title": "💾 Core",
"labels": ["core"], "labels": [
"notes" : [] "core"
],
"notes": []
}, },
{ {
"title": "📂 Github", "title": "📂 Github",
"labels": ["github"], "labels": [
"notes" : [] "github"
],
"notes": []
}, },
{ {
"title" :"📝 Documentation", "title": "📝 Documentation",
"labels": ["documentation"], "labels": [
"notes" : [] "maintenance"
],
"notes": []
}, },
{ {
"title" :"🔧 Refactor", "title": "🔧 Refactor",
"labels": ["refactor"], "labels": [
"notes" : [] "refactor"
],
"notes": []
} }
] ]
}, },
{ {
"title": "🌐 Website", "title": "🌐 Website",
"labels": ["website"], "labels": [
"website"
],
"subCategories": [ "subCategories": [
{ {
"title": "🐞 Bug Fixes", "title": "🐞 Bug Fixes",
"labels": ["bugfix"], "labels": [
"notes" : [] "bugfix"
],
"notes": []
}, },
{ {
"title": "✨ New Features", "title": "✨ New Features",
"labels": ["feature"], "labels": [
"notes" : [] "feature"
],
"notes": []
}, },
{ {
"title": "💥 Breaking Changes", "title": "💥 Breaking Changes",
"labels": ["breaking change"], "labels": [
"notes" : [] "breaking change"
],
"notes": []
}, },
{ {
"title": "📝 Script Information", "title": "📝 Script Information",
"labels": ["json"], "labels": [
"notes" : [] "json"
],
"notes": []
} }
] ]
}, },
{ {
"title": "❔ Unlabelled", "title": "❔ Unlabelled",
"labels": [] "labels": []
},
{
"title": "💥 Breaking Changes",
"labels": ["breaking change"]
} }
] ]

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

@ -34,7 +34,7 @@ jobs:
const autolabelerConfig = JSON.parse(fileContent); const autolabelerConfig = JSON.parse(fileContent);
const prNumber = context.payload.pull_request.number; const prNumber = context.payload.pull_request.number;
const prBody = context.payload.pull_request.body.toLowerCase(); const prBody = context.payload.pull_request.body || "";
let labelsToAdd = new Set(); let labelsToAdd = new Set();
@ -74,19 +74,35 @@ jobs:
"✨ **New feature**": "feature", "✨ **New feature**": "feature",
"💥 **Breaking change**": "breaking change", "💥 **Breaking change**": "breaking change",
"🆕 **New script**": "new script", "🆕 **New script**": "new script",
"🌍 **Website update**": "website", "🌍 **Website update**": "website", // handled special
"🔧 **Refactoring / Code Cleanup**": "refactor", "🔧 **Refactoring / Code Cleanup**": "refactor",
"📝 **Documentation update**": "documentation" "📝 **Documentation update**": "documentation" // mapped to maintenance
}; };
for (const [checkbox, label] of Object.entries(templateLabelMappings)) { for (const [checkbox, label] of Object.entries(templateLabelMappings)) {
const escapedCheckbox = checkbox.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1"); const escapedCheckbox = checkbox.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
const regex = new RegExp(`- \\[(x|X)\\]\\s*${escapedCheckbox}`, "i"); const regex = new RegExp(`- \\[(x|X)\\]\\s*${escapedCheckbox}`, "i");
if (regex.test(prBody)) { if (regex.test(prBody)) {
labelsToAdd.add(label); 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 (labelsToAdd.size === 0) {
labelsToAdd.add("needs triage");
}
if (labelsToAdd.size > 0) { if (labelsToAdd.size > 0) {
await github.rest.issues.addLabels({ await github.rest.issues.addLabels({

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

@ -80,7 +80,7 @@ jobs:
{ title: "💥 Breaking Changes", labels: ["breaking change"], notes: [] }, { title: "💥 Breaking Changes", labels: ["breaking change"], notes: [] },
{ title: "📡 API", labels: ["api"], notes: [] }, { title: "📡 API", labels: ["api"], notes: [] },
{ title: "Github", labels: ["github"], notes: [] }, { title: "Github", labels: ["github"], notes: [] },
{ title: "📝 Documentation", labels: ["documentation"], notes: [] }, { title: "📝 Documentation", labels: ["maintenance"], notes: [] },
{ title: "🔧 Refactor", labels: ["refactor"], notes: [] } { title: "🔧 Refactor", labels: ["refactor"], notes: [] }
] : ] :
obj.labels.includes("website") ? [ obj.labels.includes("website") ? [