Skip to content

Commit

Permalink
Make label comparison case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
luketomlinson committed Jul 12, 2021
1 parent d901397 commit 445ea44
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions dist/index.js
Expand Up @@ -540,7 +540,7 @@ class IssuesProcessor {
});
const events = yield this.client.paginate(options);
const reversedEvents = events.reverse();
const staleLabeledEvent = reversedEvents.find(event => event.event === 'labeled' && event.label.name === label);
const staleLabeledEvent = reversedEvents.find(event => event.event === 'labeled' && is_labeled_1.cleanLabel(event.label.name) === is_labeled_1.cleanLabel(label));
if (!staleLabeledEvent) {
// Must be old rather than labeled
return undefined;
Expand Down Expand Up @@ -1824,7 +1824,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isLabeled = void 0;
exports.cleanLabel = exports.isLabeled = void 0;
const lodash_deburr_1 = __importDefault(__nccwpck_require__(1601));
/**
* @description
Expand All @@ -1844,6 +1844,7 @@ exports.isLabeled = isLabeled;
function cleanLabel(label) {
return lodash_deburr_1.default(label.toLowerCase());
}
exports.cleanLabel = cleanLabel;


/***/ }),
Expand Down
4 changes: 2 additions & 2 deletions src/classes/issues-processor.ts
Expand Up @@ -7,7 +7,7 @@ import {getHumanizedDate} from '../functions/dates/get-humanized-date';
import {isDateMoreRecentThan} from '../functions/dates/is-date-more-recent-than';
import {isValidDate} from '../functions/dates/is-valid-date';
import {isBoolean} from '../functions/is-boolean';
import {isLabeled} from '../functions/is-labeled';
import {cleanLabel, isLabeled} from '../functions/is-labeled';
import {shouldMarkWhenStale} from '../functions/should-mark-when-stale';
import {wordsToList} from '../functions/words-to-list';
import {IComment} from '../interfaces/comment';
Expand Down Expand Up @@ -536,7 +536,7 @@ export class IssuesProcessor {
const reversedEvents = events.reverse();

const staleLabeledEvent = reversedEvents.find(
event => event.event === 'labeled' && event.label.name === label
event => event.event === 'labeled' && cleanLabel(event.label.name) === cleanLabel(label)
);

if (!staleLabeledEvent) {
Expand Down
2 changes: 1 addition & 1 deletion src/functions/is-labeled.ts
Expand Up @@ -21,6 +21,6 @@ export function isLabeled(
});
}

function cleanLabel(label: Readonly<string>): CleanLabel {
export function cleanLabel(label: Readonly<string>): CleanLabel {
return deburr(label.toLowerCase());
}

0 comments on commit 445ea44

Please sign in to comment.