Create utility modules for label processing
This commit is contained in:
21
integrations/utils/amount-from-labels.js
Normal file
21
integrations/utils/amount-from-labels.js
Normal file
@@ -0,0 +1,21 @@
|
||||
module.exports = function (labels) {
|
||||
const kreditsLabel = labels.filter(n => n.match(/^kredits/))[0];
|
||||
// No label, no kredits
|
||||
if (typeof kreditsLabel === 'undefined') { return 0; }
|
||||
|
||||
// TODO move amounts to config?
|
||||
let amount;
|
||||
switch(kreditsLabel) {
|
||||
case 'kredits-1':
|
||||
amount = 500;
|
||||
break;
|
||||
case 'kredits-2':
|
||||
amount = 1500;
|
||||
break;
|
||||
case 'kredits-3':
|
||||
amount = 5000;
|
||||
break;
|
||||
}
|
||||
|
||||
return amount;
|
||||
};
|
||||
18
integrations/utils/kind-from-labels.js
Normal file
18
integrations/utils/kind-from-labels.js
Normal file
@@ -0,0 +1,18 @@
|
||||
module.exports = function (labels) {
|
||||
let kind = 'dev';
|
||||
|
||||
if (labels.find(l => l.match(/ops|operations/))) {
|
||||
kind = 'ops';
|
||||
}
|
||||
else if (labels.find(l => l.match(/docs|documentation/))) {
|
||||
kind = 'docs';
|
||||
}
|
||||
else if (labels.find(l => l.match(/design/))) {
|
||||
kind = 'design';
|
||||
}
|
||||
else if (labels.find(l => l.match(/community/))) {
|
||||
kind = 'community';
|
||||
}
|
||||
|
||||
return kind;
|
||||
};
|
||||
Reference in New Issue
Block a user