Skip to content

Commit

Permalink
add back 'COMPLEXITY_EXCEPTIONS' - still needed
Browse files Browse the repository at this point in the history
  • Loading branch information
t-will-gillis committed Nov 28, 2024
1 parent b948946 commit aea587c
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const [
featureMissing,
complexityMissing,
roleMissing,
complexity1,
complexity2,
readyForDevLead,
featureAdministrative,
Expand All @@ -20,6 +21,7 @@ const [
"featureMissing",
"complexityMissing",
"roleMissing",
"complexity1",
"complexity2",
"readyForDevLead",
"featureAdministrative",
Expand All @@ -30,10 +32,11 @@ const [
// Constant variables
const REQUIRED_LABELS = ['complexity', 'role', 'feature', 'size'];
const LABEL_MISSING = [complexityMissing, roleMissing, featureMissing, sizeMissing];

// Exception for the `good first issue` label
const COMPLEXITY_EXCEPTIONS = [complexity1];

// SPECIAL_CASE is for issue created by reference with issue title "Hack for LA website bot"
// (from "Review Inactive Team Members", "Schedule Monthly" workflow)
// ("Review Inactive Team Members" from the "Schedule Monthly" workflow)
const SPECIAL_CASE = [readyForDevLead, featureAdministrative, size025pt, complexity2, roleDevLeads];

// Global variables
Expand Down Expand Up @@ -110,14 +113,19 @@ function checkLabels(labels) {
REQUIRED_LABELS.forEach((requiredLabel, i) => {
const regExp = new RegExp(`\\b${requiredLabel}\\b`, 'gi');
const isLabelPresent = labels.some(label => {
// If the label is in the complexity exceptions array, it also fulfills the complexity requirements
if (COMPLEXITY_EXCEPTIONS.includes(label) && requiredLabel === 'Complexity') {
return true;
}

return regExp.test(label);
})

if (isLabelPresent === false) {
labelsToAdd.push(LABEL_MISSING[i]);
}
})

return labelsToAdd;
}

Expand Down

0 comments on commit aea587c

Please sign in to comment.