From 2ff778db9ab88c4c8a6f4612489c0e09cc88934c Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Wed, 9 Jul 2025 14:09:11 +0200 Subject: [PATCH] Github: AutoLabler | ChangeLog (Refactor) (#5868) --- .github/autolabeler-config.json | 57 ++++++-------- .github/changelog-pr-config.json | 120 +++++++++++++++++++---------- .github/workflows/autolabeler.yml | 24 +++++- .github/workflows/changelog-pr.yml | 2 +- 4 files changed, 124 insertions(+), 79 deletions(-) diff --git a/.github/autolabeler-config.json b/.github/autolabeler-config.json index 1b30e419b..d93bcfcb0 100644 --- a/.github/autolabeler-config.json +++ b/.github/autolabeler-config.json @@ -4,6 +4,7 @@ "fileStatus": "added", "includeGlobs": [ "ct/**", + "tools/**", "install/**", "misc/**", "turnkey/**", @@ -17,16 +18,13 @@ "fileStatus": "modified", "includeGlobs": [ "ct/**", + "tools/**", "install/**", "misc/**", "turnkey/**", "vm/**" ], - "excludeGlobs": [ - "misc/build.func", - "misc/install.func", - "misc/api.func" - ] + "excludeGlobs": [] } ], "delete script": [ @@ -34,6 +32,21 @@ "fileStatus": "removed", "includeGlobs": [ "ct/**", + "tools/**", + "install/**", + "misc/**", + "turnkey/**", + "vm/**" + ], + "excludeGlobs": [] + } + ], + "breaking change": [ + { + "fileStatus": null, + "includeGlobs": [ + "ct/**", + "tools/**", "install/**", "misc/**", "turnkey/**", @@ -46,11 +59,7 @@ { "fileStatus": null, "includeGlobs": [ - "*.md", - ".github/**", - "misc/*.func", - "misc/create_lxc.sh", - "api/**" + "*.md" ], "excludeGlobs": [] } @@ -62,7 +71,9 @@ "misc/*.func", "misc/create_lxc.sh" ], - "excludeGlobs": [] + "excludeGlobs": [ + "misc/api.func" + ] } ], "website": [ @@ -71,7 +82,9 @@ "includeGlobs": [ "frontend/**" ], - "excludeGlobs": [] + "excludeGlobs": [ + "frontend/public/json/**" + ] } ], "api": [ @@ -102,26 +115,6 @@ "excludeGlobs": [] } ], - "high risk": [ - { - "fileStatus": null, - "includeGlobs": [ - "misc/build.func", - "misc/install.func", - "misc/create_lxc.sh" - ], - "excludeGlobs": [] - } - ], - "documentation": [ - { - "fileStatus": null, - "includeGlobs": [ - "*.md" - ], - "excludeGlobs": [] - } - ], "addon": [ { "fileStatus": null, diff --git a/.github/changelog-pr-config.json b/.github/changelog-pr-config.json index 2f4eae06e..e556703d0 100644 --- a/.github/changelog-pr-config.json +++ b/.github/changelog-pr-config.json @@ -1,112 +1,148 @@ [ { "title": "🆕 New Scripts", - "labels": ["new script"] + "labels": [ + "new script" + ] }, { "title": "🚀 Updated Scripts", - "labels": ["update script"], + "labels": [ + "update script" + ], "subCategories": [ { "title": "🐞 Bug Fixes", - "labels": ["bugfix"], - "notes" : [] + "labels": [ + "bugfix" + ], + "notes": [] }, { "title": "✨ New Features", - "labels": ["feature"], - "notes" : [] + "labels": [ + "feature" + ], + "notes": [] }, { "title": "💥 Breaking Changes", - "labels": ["breaking change"], - "notes" : [] + "labels": [ + "breaking change" + ], + "notes": [] }, { "title": "🔧 Refactor", - "labels": ["refactor"], - "notes" : [] + "labels": [ + "refactor" + ], + "notes": [] } ] }, { "title": "🧰 Maintenance", - "labels": ["maintenance"], + "labels": [ + "maintenance" + ], "subCategories": [ { "title": "🐞 Bug Fixes", - "labels": ["bugfix"], - "notes" : [] + "labels": [ + "bugfix" + ], + "notes": [] }, { "title": "✨ New Features", - "labels": ["feature"], - "notes" : [] + "labels": [ + "feature" + ], + "notes": [] }, { "title": "💥 Breaking Changes", - "labels": ["breaking change"], - "notes" : [] + "labels": [ + "breaking change" + ], + "notes": [] }, { "title": "📡 API", - "labels": ["api"], - "notes" : [] + "labels": [ + "api" + ], + "notes": [] }, { "title": "💾 Core", - "labels": ["core"], - "notes" : [] + "labels": [ + "core" + ], + "notes": [] }, { "title": "📂 Github", - "labels": ["github"], - "notes" : [] + "labels": [ + "github" + ], + "notes": [] }, { - "title" :"📝 Documentation", - "labels": ["documentation"], - "notes" : [] + "title": "📝 Documentation", + "labels": [ + "maintenance" + ], + "notes": [] }, { - "title" :"🔧 Refactor", - "labels": ["refactor"], - "notes" : [] + "title": "🔧 Refactor", + "labels": [ + "refactor" + ], + "notes": [] } ] }, { "title": "🌐 Website", - "labels": ["website"], + "labels": [ + "website" + ], "subCategories": [ { "title": "🐞 Bug Fixes", - "labels": ["bugfix"], - "notes" : [] + "labels": [ + "bugfix" + ], + "notes": [] }, { "title": "✨ New Features", - "labels": ["feature"], - "notes" : [] + "labels": [ + "feature" + ], + "notes": [] }, { "title": "💥 Breaking Changes", - "labels": ["breaking change"], - "notes" : [] + "labels": [ + "breaking change" + ], + "notes": [] }, { "title": "📝 Script Information", - "labels": ["json"], - "notes" : [] + "labels": [ + "json" + ], + "notes": [] } ] }, { "title": "❔ Unlabelled", "labels": [] - }, - { - "title": "💥 Breaking Changes", - "labels": ["breaking change"] } ] diff --git a/.github/workflows/autolabeler.yml b/.github/workflows/autolabeler.yml index 831cc1867..6c6b564c6 100644 --- a/.github/workflows/autolabeler.yml +++ b/.github/workflows/autolabeler.yml @@ -34,7 +34,7 @@ jobs: const autolabelerConfig = JSON.parse(fileContent); 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(); @@ -74,19 +74,35 @@ jobs: "✨ **New feature**": "feature", "💥 **Breaking change**": "breaking change", "🆕 **New script**": "new script", - "🌍 **Website update**": "website", + "🌍 **Website update**": "website", // handled special "🔧 **Refactoring / Code Cleanup**": "refactor", - "📝 **Documentation update**": "documentation" + "📝 **Documentation update**": "documentation" // mapped to maintenance }; 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)) { - 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) { await github.rest.issues.addLabels({ diff --git a/.github/workflows/changelog-pr.yml b/.github/workflows/changelog-pr.yml index dd23df0ea..812b80538 100644 --- a/.github/workflows/changelog-pr.yml +++ b/.github/workflows/changelog-pr.yml @@ -80,7 +80,7 @@ jobs: { title: "💥 Breaking Changes", labels: ["breaking change"], notes: [] }, { title: "📡 API", labels: ["api"], notes: [] }, { title: "Github", labels: ["github"], notes: [] }, - { title: "📝 Documentation", labels: ["documentation"], notes: [] }, + { title: "📝 Documentation", labels: ["maintenance"], notes: [] }, { title: "🔧 Refactor", labels: ["refactor"], notes: [] } ] : obj.labels.includes("website") ? [