diff --git a/README.md b/README.md index f96897c..45c6f7c 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ As YAML: - The `name` property refers to the label name. - The `color` property should be a hex code, with or without the leading `#`. -- The `delete` property is optional. When set to true, matches for this label will _always_ be deleted. This can be used in conjunction with [allowAddedLabels](#allowaddedlabels) to flag specific labels for deletion while leaving non-specified labels intact. +- The `delete` property is optional. When set to `true`, matches for this label will _always_ be deleted. This can be used in conjunction with [allowAddedLabels](#allowaddedlabels) to flag specific labels for deletion while leaving non-specified labels intact. Defaults to `false`. The `aliases` property is optional. When GitHub Label Sync is determining whether to update or delete/create a label it will use the aliases property to prevent used labels from being deleted. diff --git a/lib/calculate-label-diff.js b/lib/calculate-label-diff.js index 0f6bcbc..7c7dd9a 100644 --- a/lib/calculate-label-diff.js +++ b/lib/calculate-label-diff.js @@ -32,7 +32,9 @@ function calculateLabelDiff(currentLabels, configuredLabels, allowAddedLabels) { matches.forEach((matchedLabel, index) => { - if (configuredLabel.delete) return diff.push(createAddedEntry(matchedLabel)); + if (configuredLabel.delete) { + return diff.push(createAddedEntry(matchedLabel)); + } const matchedDescription = getLabelDescription(matchedLabel); const configuredDescription = getLabelDescription(configuredLabel, matchedDescription); @@ -55,7 +57,9 @@ function calculateLabelDiff(currentLabels, configuredLabels, allowAddedLabels) { }); currentLabels.filter(label => resolvedLabels.indexOf(label) === -1).forEach((currentLabel) => { - if(!allowAddedLabels) diff.push(createAddedEntry(currentLabel)); + if (!allowAddedLabels) { + diff.push(createAddedEntry(currentLabel)); + } }); return diff; } diff --git a/lib/validate-label-format.js b/lib/validate-label-format.js index 3657b51..3cf86e4 100644 --- a/lib/validate-label-format.js +++ b/lib/validate-label-format.js @@ -10,7 +10,7 @@ const schema = { name: { type: 'string', maxLength: 50, }, color: { type: 'string', pattern: '^[a-fA-F0-9]{6}$' }, description: { type: 'string', maxLength: 100 }, - delete: { type: 'boolean' }, + delete: { type: 'boolean', default: false }, aliases: { type: 'array', items: { type: 'string', maxLength: 50 }