mirror of
https://github.com/actions/stale.git
synced 2025-12-20 06:42:15 +00:00
Make label comparison case insensitive (#517)
* Make label comparison case insensitive * PR Feedback
This commit is contained in:
@@ -8,6 +8,7 @@ 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 } from '../functions/clean-label';
|
||||
import {shouldMarkWhenStale} from '../functions/should-mark-when-stale';
|
||||
import {wordsToList} from '../functions/words-to-list';
|
||||
import {IComment} from '../interfaces/comment';
|
||||
@@ -536,7 +537,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) {
|
||||
|
||||
14
src/functions/clean-label.ts
Normal file
14
src/functions/clean-label.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import deburr from 'lodash.deburr';
|
||||
import { CleanLabel } from '../types/clean-label';
|
||||
|
||||
/**
|
||||
* @description
|
||||
* Clean a label by lowercasing it and deburring it for consistency
|
||||
*
|
||||
* @param {string} label A raw GitHub label
|
||||
*
|
||||
* @return {string} A lowercased, deburred version of the passed in label
|
||||
*/
|
||||
export function cleanLabel(label: Readonly<string>): CleanLabel {
|
||||
return deburr(label.toLowerCase());
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
import deburr from 'lodash.deburr';
|
||||
import {Issue} from '../classes/issue';
|
||||
import {ILabel} from '../interfaces/label';
|
||||
import {CleanLabel} from '../types/clean-label';
|
||||
import {cleanLabel} from './clean-label';
|
||||
|
||||
/**
|
||||
* @description
|
||||
@@ -20,7 +19,3 @@ export function isLabeled(
|
||||
return cleanLabel(label) === cleanLabel(issueLabel.name);
|
||||
});
|
||||
}
|
||||
|
||||
function cleanLabel(label: Readonly<string>): CleanLabel {
|
||||
return deburr(label.toLowerCase());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user