- use toLocaleLowerCase to ensure we have proper locale dependent lowercase behavior

- ensure we also match the configuration case independent
This commit is contained in:
Mike Penz
2021-06-23 11:54:45 +02:00
parent 49aee4dc11
commit 4d47219031
5 changed files with 21 additions and 11 deletions
Generated Vendored
+5 -5
View File
@@ -522,7 +522,7 @@ const mapPullRequest = (pr) => {
repoName: pr.base.repo.full_name, repoName: pr.base.repo.full_name,
labels: new Set(((_b = pr.labels) === null || _b === void 0 ? void 0 : _b.map(function (label) { labels: new Set(((_b = pr.labels) === null || _b === void 0 ? void 0 : _b.map(function (label) {
var _a; var _a;
return ((_a = label.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || ''; return ((_a = label.name) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) || '';
})) || []), })) || []),
milestone: ((_c = pr.milestone) === null || _c === void 0 ? void 0 : _c.title) || '', milestone: ((_c = pr.milestone) === null || _c === void 0 ? void 0 : _c.title) || '',
body: pr.body || '', body: pr.body || '',
@@ -942,7 +942,7 @@ class Tags {
try { try {
const length = tags.length; const length = tags.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
if (tags[i].name.toLowerCase() === tag.toLowerCase()) { if (tags[i].name.toLocaleLowerCase() === tag.toLocaleLowerCase()) {
if (ignorePreReleases) { if (ignorePreReleases) {
core.info(`️ Enabled 'ignorePreReleases', searching for the closest release`); core.info(`️ Enabled 'ignorePreReleases', searching for the closest release`);
for (let ii = i + 1; ii < length; ii++) { for (let ii = i + 1; ii < length; ii++) {
@@ -1091,7 +1091,7 @@ function buildChangelog(prs, config, options) {
label = pr.body.replace(extractor.pattern, extractor.target); label = pr.body.replace(extractor.pattern, extractor.target);
} }
if (label !== '') { if (label !== '') {
pr.labels.add(label.toLowerCase()); pr.labels.add(label.toLocaleLowerCase());
} }
} }
} }
@@ -1116,13 +1116,13 @@ function buildChangelog(prs, config, options) {
const uncategorizedPrs = []; const uncategorizedPrs = [];
// bring elements in order // bring elements in order
for (const [pr, body] of transformedMap) { for (const [pr, body] of transformedMap) {
if (haveCommonElements(ignoredLabels, pr.labels)) { if (haveCommonElements(ignoredLabels.map(lbl => lbl.toLocaleLowerCase()), pr.labels)) {
ignoredPrs.push(body); ignoredPrs.push(body);
continue; continue;
} }
let matched = false; let matched = false;
for (const [category, pullRequests] of categorized) { for (const [category, pullRequests] of categorized) {
if (haveCommonElements(category.labels, pr.labels)) { if (haveCommonElements(category.labels.map(lbl => lbl.toLocaleLowerCase()), pr.labels)) {
pullRequests.push(body); pullRequests.push(body);
matched = true; matched = true;
} }
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -131,7 +131,7 @@ const mapPullRequest = (
repoName: pr.base.repo.full_name, repoName: pr.base.repo.full_name,
labels: new Set( labels: new Set(
pr.labels?.map(function (label) { pr.labels?.map(function (label) {
return label.name?.toLowerCase() || '' return label.name?.toLocaleLowerCase() || ''
}) || [] }) || []
), ),
milestone: pr.milestone?.title || '', milestone: pr.milestone?.title || '',
+1 -1
View File
@@ -65,7 +65,7 @@ export class Tags {
try { try {
const length = tags.length const length = tags.length
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
if (tags[i].name.toLowerCase() === tag.toLowerCase()) { if (tags[i].name.toLocaleLowerCase() === tag.toLocaleLowerCase()) {
if (ignorePreReleases) { if (ignorePreReleases) {
core.info( core.info(
`️ Enabled 'ignorePreReleases', searching for the closest release` `️ Enabled 'ignorePreReleases', searching for the closest release`
+13 -3
View File
@@ -39,7 +39,7 @@ export function buildChangelog(
label = pr.body.replace(extractor.pattern, extractor.target) label = pr.body.replace(extractor.pattern, extractor.target)
} }
if (label !== '') { if (label !== '') {
pr.labels.add(label.toLowerCase()) pr.labels.add(label.toLocaleLowerCase())
} }
} }
} }
@@ -81,14 +81,24 @@ export function buildChangelog(
// bring elements in order // bring elements in order
for (const [pr, body] of transformedMap) { for (const [pr, body] of transformedMap) {
if (haveCommonElements(ignoredLabels, pr.labels)) { if (
haveCommonElements(
ignoredLabels.map(lbl => lbl.toLocaleLowerCase()),
pr.labels
)
) {
ignoredPrs.push(body) ignoredPrs.push(body)
continue continue
} }
let matched = false let matched = false
for (const [category, pullRequests] of categorized) { for (const [category, pullRequests] of categorized) {
if (haveCommonElements(category.labels, pr.labels)) { if (
haveCommonElements(
category.labels.map(lbl => lbl.toLocaleLowerCase()),
pr.labels
)
) {
pullRequests.push(body) pullRequests.push(body)
matched = true matched = true
} }