mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-09-13 07:10:51 +02:00
This reverts commit 893bff1b59.
This commit is contained in:
committed by
GitHub
parent
aba73bd0f8
commit
029332fb51
28
.github/workflows/autolabeler.yml
vendored
28
.github/workflows/autolabeler.yml
vendored
@@ -32,9 +32,8 @@ 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();
|
||||
|
||||
const prListFilesResponse = await github.rest.pulls.listFiles({
|
||||
@@ -43,35 +42,14 @@ jobs:
|
||||
pull_number: prNumber,
|
||||
});
|
||||
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
|
||||
for (const [label, rules] of Object.entries(autolabelerConfig)) {
|
||||
const shouldAddLabel = prFiles.some((prFile) => {
|
||||
return rules.some((rule) => {
|
||||
const isFileStatusMatch = rule.fileStatus ? rule.fileStatus === prFile.status : true;
|
||||
const isIncludeGlobMatch = rule.includeGlobs.some((glob) => minimatch(prFile.filename, glob));
|
||||
const isExcludeGlobMatch = rule.excludeGlobs.some((glob) => minimatch(prFile.filename, glob));
|
||||
|
||||
|
||||
return isFileStatusMatch && isIncludeGlobMatch && !isExcludeGlobMatch;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user