@@ -11,14 +11,14 @@ jobs:
1111 permissions :
1212 pull-requests : write
1313 env :
14- CONFIG_PATH : .github/autolabeler-config .json
14+ CONFIG_PATH : .github/autolabeler-config_new .json
1515 steps :
1616 - name : Checkout repository
1717 uses : actions/checkout@v4
1818
19- - name : Install minimatch
19+ - name : Install dependencies
2020 run : npm install minimatch
21-
21+
2222 - name : Label PR based on file changes and PR template
2323 uses : actions/github-script@v7
2424 with :
@@ -61,21 +61,26 @@ jobs:
6161 labelsToAdd.add(label);
6262 }
6363 }
64- const templateLabelMappings = {
65- "🐞 **Bug fix**": "bugfix",
66- "✨ **New feature**": "feature",
67- "💥 **Breaking change**": "breaking change",
68- };
69-
70- for (const [checkbox, label] of Object.entries(templateLabelMappings)) {
71- const escapedCheckbox = checkbox.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
72- const regex = new RegExp(`- \\[(x|X)\\]\\s*.*${escapedCheckbox}`, "i");
73- const match = prBody.match(regex);
74- if (match) {
75- console.log(`Match: ${match}`);
76- labelsToAdd.add(label);
64+ //if two labels or more are added, return
65+ if (labelsToAdd.size < 2) {
66+ const templateLabelMappings = {
67+ "🐞 **Bug fix**": "bugfix",
68+ "✨ **New feature**": "feature",
69+ "💥 **Breaking change**": "breaking change",
70+ };
71+
72+ for (const [checkbox, label] of Object.entries(templateLabelMappings)) {
73+ const escapedCheckbox = checkbox.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
74+ const regex = new RegExp(`- \\[(x|X)\\]\\s*.*${escapedCheckbox}`, "i");
75+ const match = prBody.match(regex);
76+ if (match) {
77+ console.log(`Match: ${match}`);
78+ labelsToAdd.add(label);
79+ }
7780 }
7881 }
82+
83+
7984
8085 console.log(`Labels to add: ${Array.from(labelsToAdd).join(", ")}`);
8186
0 commit comments