mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-05-16 08:40:25 +00:00
Update autolabeler.yml (#2968)
This commit is contained in:
parent
d4ac4809c0
commit
8441e65000
37
.github/workflows/autolabeler.yml
vendored
37
.github/workflows/autolabeler.yml
vendored
@ -11,14 +11,14 @@ 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
|
||||||
|
|
||||||
- name: Install minimatch
|
- name: Install dependencies
|
||||||
run: npm install minimatch
|
run: npm install minimatch
|
||||||
|
|
||||||
- name: Label PR based on file changes and PR template
|
- name: Label PR based on file changes and PR template
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
@ -61,21 +61,26 @@ jobs:
|
|||||||
labelsToAdd.add(label);
|
labelsToAdd.add(label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const templateLabelMappings = {
|
//if two labels or more are added, return
|
||||||
"🐞 **Bug fix**": "bugfix",
|
if (labelsToAdd.size < 2) {
|
||||||
"✨ **New feature**": "feature",
|
const templateLabelMappings = {
|
||||||
"💥 **Breaking change**": "breaking change",
|
"🐞 **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");
|
for (const [checkbox, label] of Object.entries(templateLabelMappings)) {
|
||||||
const match = prBody.match(regex);
|
const escapedCheckbox = checkbox.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
|
||||||
if (match) {
|
const regex = new RegExp(`- \\[(x|X)\\]\\s*.*${escapedCheckbox}`, "i");
|
||||||
console.log(`Match: ${match}`);
|
const match = prBody.match(regex);
|
||||||
labelsToAdd.add(label);
|
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(", ")}`);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user