Skip to content

Commit 3bd1f50

Browse files
LiSmiRomuloVitoi
authored andcommitted
Apply suggestions from code review
Co-authored-by: Rômulo Vitoi <[email protected]>
1 parent 490ea31 commit 3bd1f50

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ As YAML:
185185
186186
- The `name` property refers to the label name.
187187
- The `color` property should be a hex code, with or without the leading `#`.
188-
- 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.
188+
- 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`.
189189

190190
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.
191191

lib/calculate-label-diff.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ function calculateLabelDiff(currentLabels, configuredLabels, allowAddedLabels) {
3232

3333
matches.forEach((matchedLabel, index) => {
3434

35-
if (configuredLabel.delete) return diff.push(createAddedEntry(matchedLabel));
35+
if (configuredLabel.delete) {
36+
return diff.push(createAddedEntry(matchedLabel));
37+
}
3638

3739
const matchedDescription = getLabelDescription(matchedLabel);
3840
const configuredDescription = getLabelDescription(configuredLabel, matchedDescription);
@@ -55,7 +57,9 @@ function calculateLabelDiff(currentLabels, configuredLabels, allowAddedLabels) {
5557

5658
});
5759
currentLabels.filter(label => resolvedLabels.indexOf(label) === -1).forEach((currentLabel) => {
58-
if(!allowAddedLabels) diff.push(createAddedEntry(currentLabel));
60+
if (!allowAddedLabels) {
61+
diff.push(createAddedEntry(currentLabel));
62+
}
5963
});
6064
return diff;
6165
}

lib/validate-label-format.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const schema = {
1010
name: { type: 'string', maxLength: 50, },
1111
color: { type: 'string', pattern: '^[a-fA-F0-9]{6}$' },
1212
description: { type: 'string', maxLength: 100 },
13-
delete: { type: 'boolean' },
13+
delete: { type: 'boolean', default: false },
1414
aliases: {
1515
type: 'array',
1616
items: { type: 'string', maxLength: 50 }

0 commit comments

Comments
 (0)